Page 1 of 1

onLoad event handler

Posted: Mon Nov 18, 2002 9:14 am
by jonat8
Hi,

I'm trying to get Javascript to execute a function when the page finishes loading:
<body background="exptextb.jpg" onLoad="javascript:pM">
and directly below that is the function:
<SCRIPT LANGUAGE=JavaScript>


function pM {
WindowsMediaPlayer.FileName = "/mediabase/" + <?php echo $tracktoplay ?>;
}

</SCRIPT>
But for some reason that doesn't seem to work, I just get the error in IE that "pM is undefined". It looks okay to me, or is there something I'm missing?! I've tried just putting ..."onLoad="pM"... instead of javascript:pM but it still doesn't work.

TIA for any help
jonat8

Posted: Mon Nov 18, 2002 9:16 am
by volka
try

Code: Select all

<SCRIPT LANGUAGE=JavaScript>
	function pM() &#123;
		WindowsMediaPlayer.FileName = "/mediabase/" + <?php echo $tracktoplay ?>;
	&#125;
</SCRIPT>
...
<body background="exptextb.jpg" onLoad="javascript:pM();">
...