Forum Moderators: open

Message Too Old, No Replies

pop-up in javascript

works in ie, not ns

         

halfandhalf

3:52 am on Oct 27, 2003 (gmt 0)

10+ Year Member



i'm trying to have a smaller window pop up when users go to a page, but it doesn't work in netscape.

here's the code:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=1,statusbar=1,menubar=0,resizable=1,width=650,height=850');");
}
// End -->
</script>

here's the reference:
<BODY LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0" bgcolor=white onLoad="javascript:popUp('twa.pdf')">

any ideas on why this doesn't work in netscape?
Thanks!

MonkeeSage

12:14 pm on Oct 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Possibly because the <script> element needs a type attribute (type="text/javascript"), but more likely I would think because of the built in popup blocking in the (relatively) newer versions of netscape / mozilla, which blocks unrequested popups such as those displayed when the page is loaded. That's my guess.

Jordan

jomaxx

6:16 pm on Oct 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't know if it's causing the problem but you don't need the "javascript:" part of the statement. Within the onLoad function I assume it's implied.

jomaxx

6:25 pm on Oct 27, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



P.S. Just stick in an alert() statement to make sure the function is getting called at all, and to see where it might be going off the rails.

P.P.S. I would think twice about triggering a popup containing a PDF document. That causes quite a delay on my fairly new PC, and I'm sure that many browsers won't be able to view it at all without the plugin.