PDA

View Full Version : new window script assistance needed


robert2
02-29-2004, 05:56 AM
Hi,

I'm new to java.
Just found an easy and reasonable looking script from http://www.a1javascripts.com/site_navigation/opennewwin2/opennewwin2.html.
But when following instructions - the script doesn't work.
Probably something essential missing, which the author didn't mention. There is no frames. The purpose is to open new smaller info window without toolbars. While clicking i get error on page
Can anyone point out what i'm doing wrong?

tia robert

<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Kambja</title>
<script>
function remote(url){
window.opener.location=url
}
</script>
</head>

<body background="kambja.gif" bgproperties="fixed">
<script>
function chgMainWinLoc( strPage ) {
parent.opener.document.location = strPage;
}
</script>
<p>&nbsp;</p>
<a href="javascript: chgMainWinLoc( YOUR_PAGE.html )">Open my window</A>
</body>

</html>

agent002
02-29-2004, 07:09 AM
You have the wrong script - the purpose of that script is to put into a popup, and when the link is clicked, the location of its opener window changes. You're looking for the opposite, how to open a popup window. So what you need is this code between the <head> and </head> tags:
<script type="text/javascript">
function OpenPopup(w, atts){
window.open(w.href, '_blank', atts);
return false;
}
</script>
Then use this code for a link:
<a href="url here" onclick="return OpenPopup(this, 'width=300,height=400,scrollbars=yes,resizable=yes');">Click here</a>

amaR
02-29-2004, 07:10 AM
hi i m no pro...

but for a new window ..


<html>
<head>
<SCRIPT LANGUAGE="javascript">

popup_window = null;
function popup() {
popup_window = window.open('popup.html', 'popup',
'width=500,height=500,resizable=0,menubar=no,scrollbars=no,statusbar=no');
}

</SCRIPT>

</head>
<body>
<form>
<input type="button" value="Enter Here" onClick="popup()"
</form>

<br><br>

<a href='javascript:popup()'><IMG SRC="any_pic.gif" BORDER="0" ALT="Enter"></a>

<br><br>

<a href='javascript:popup()'>Open new window</a>
</body>
</html>


something very werid... i type no space for javascript in the code but the result has a space when I post this reply

NOTE* <a href='javascript:popup()'> -- there is not space in the middle of java script

this gives popup from a button, picture and text ..

amaR

robert2
02-29-2004, 10:33 AM
Thanks for all replies.
I read the agent's one first and it works as expected.

amaR
02-29-2004, 10:16 PM
glad to hear....

/*FuNGuS*/
03-12-2004, 07:27 AM
Originally posted by agent002
You have the wrong script - the purpose of that script is to put into a popup, and when the link is clicked, the location of its opener window changes. You're looking for the opposite, how to open a popup window. So what you need is this code between the <head> and </head> tags:
<script type="text/javascript">
function OpenPopup(w, atts){
window.open(w.href, '_blank', atts);
return false;
}
</script>
Then use this code for a link:
<a href="url here" onclick="return OpenPopup(this, 'width=300,height=400,scrollbars=yes,resizable=yes');">Click here</a>

How would I go about making it not resizable?

agent002
03-12-2004, 07:34 AM
isn't it quite obvious?
onclick="return OpenPopup(this, 'width=300,height=400,scrollbars=yes,resizable=no');"

/*FuNGuS*/
03-12-2004, 07:37 AM
lmmfao, yes, sorry for wasting your time. :P ty

agent002
03-12-2004, 08:02 AM
ah, no problem :)