Onload works with IE but not FF

hello forum!

can someone please, PLEASE, tell me why this combo works perfectly in IE and FF:

<script language=“JavaScript” type=“text/JavaScript”>
<!–
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//–>
</script>

echo <<<EOD
<td width=“45” height=“65” class=“{$class}” onclick=“javascript:MM_openBrWindow(‘/schedule/schedule_this_day.php?day={$i}’,‘’,‘width=300,height=625’);”>
EOD;

and this combo seems to be working (I think) in IE, but is being totally ignored by FF?

<script language=“JavaScript” type=“text/JavaScript”>
<!–
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//–>
</script>

<BODY onLoad=“javascript:MM_openBrWindow(‘/messaging/dummy_note.php?title=<?php echo $event_title; ?>&date=<?php echo $event_date; ?>’,‘’,‘width=500,height=400’);”>
</BODY>

tried looking for the answer around here but I’m in way over my head, and it looks like this stuff can get really complicated.
not asking for a solution - just want to know if the problem lies within what I put up here (I hope), or if it’s something I’m doing elsewhere.
MANY THANKS :slight_smile:

It may be that other things are clobbering the onload event.

Move the script to the bottom of the page, just before the </body> tag.


<body>
<!-- start html content -->
...
<!-- end html content -->
<script type="text/javascript">
// javascript code here
</script>
</body>
</html>

Then for the javascript code, place the old onload code there.


MM_openBrWindow('/messaging/dummy_note.php','','width=500,height=400');

That will then be a lot more stable.

If scripting still doesn’t start, then it’s likely that something else is causing a scripting error which stops all further scripting from occurring. A deeper look in to a test demo page may be appropriate.

thanks for your gracious response Stomme poes.

yea, it’s a mess & now a real can of worms - more trouble than it’s worth. I think I’ll just make it an onclick, or drop it all together.

as far as the passing of variables, even

<BODY onLoad=“javascript:MM_openBrWindow(‘/messaging/dummy_note.php’,‘’,‘width=500,height=400’);”></BODY>

did nothing at all - no popup.

thanks again though! best regards,

-mike

There are many many forbidden and wretched things in all versions of the code above… just so you know.

My guess is that the second one has issues because it’s got PHP in there, while the first has plain text. But I’m not sure, because what you posted is not what the browser sees.

Could you do a View Source and post that? That’s what the browser sees: your PHP will be HTML in the regular part of the page, and I’m curious to see what the PHP in the script tags become… PHP or HTML?
Or, does the second version work if you put plain text in there instead of PHP?