PDA

View Full Version : Make my own popups - help!



Darin
July 10th, 2001, 17:47
Hello!

I wanted to ask if anyone knows the javascript code to make a 250x250 popup open when somebody visits my site, with my own advertisement inside? For example: Amazon.com. They have their own popups with promotional offers and a close button.

If anyone can help, please do! Look forward for someone to reply! :)

lucifer
July 10th, 2001, 18:09
w=window.open("mypage.html",'win_name',"width=250, height=250, scrollbars=yes");

there are lots of options for the 3rd parameter like scrollbars

Darin
July 10th, 2001, 18:50
Where exactly do I put that code? And are there any other lines? Like:



<SCRIPT language="JavaScript">
<!--w=window.open("mypage.html",'win_name',"width=250, height=250, scrollbars=yes");</script>

When I put only:


w=window.open("mypage.html",'win_name',"width=250, height=250, scrollbars=yes");

It didn't work.

lucifer
July 10th, 2001, 18:58
<SCRIPT language="JavaScript">
<!-- this is a comment line so the code needs to be on the next one
w=window.open("mypage.html",'win_name',"width=250, height=250, scrollbars=yes");
//-->
</script>

Darin
July 10th, 2001, 19:03
Thank you soooo much!!! It worked, check it out - HomeSims.com (http://www.homesims.com/). :D :D :D

Dusty
July 10th, 2001, 19:11
You should remove the spaces between the items in the third parameter (change it to "width=300,height=310,scrollbars=no"), otherwise Netscape won't recognize them and will show the window as being maximized, and you should declare w as a variable before you use it but that's not harming anything.

lucifer
July 10th, 2001, 19:17
Originally posted by Dusty
You should remove the spaces between the items in the third parameter (change it to "width=300,height=310,scrollbars=no"), otherwise Netscape won't recognize them and will show the window as being maximized,
what versions of NS?

Dusty
July 10th, 2001, 19:23
4.5 and below and probably above (but I don't know about that). It works with spaces in version 6, though. Speaking of Netscape 6, you should also add:

w.focus();

Otherwise the main window will regain focus after the script is run and the popup becomes a popunder. Same goes for the most recent release of Mozilla.

lucifer
July 11th, 2001, 04:44
ah that might explain why I've seen no problems I only have vers after 4.5

focus() is definatly useful