PDA

View Full Version : <body onLoad="...">



Drunken
September 7th, 2003, 12:50 PM
heya!

How can put on tag <body> on parameter onLoad to call 2 functions?

I try to do like this:
<body onLoad="runmikescroll(); MM_preloadImages('imagens/fav-on.gif','imagens/sug-on.gif','imagens/priv-on.gif','imagens/lk1-on.gif','imagens/lk2-on.gif','imagens/lk3-on.gif','imagens/lk4-on.gif','imagens/lk5-on.gif','imagens/lk6-on.gif','imagens/lk7-on.gif');">

i want to call runmikescroll(); and load the images but doesn't work :(

any sugestion?

thks

Voetsjoeba
September 7th, 2003, 12:54 PM
Make a function that calls the two other functions, then call that function onLoad ;)

lostinbeta
September 7th, 2003, 12:57 PM
It should work.... as an example try this...


<HTML>
<HEAD>
<TITLE>JS Test</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function A(){
document.write("Function A Triggered<BR>")
}
function B(){
document.write("Function B Triggered<BR>")
}
-->
</SCRIPT>
</HEAD>

<BODY onLoad="A(); B();">

</BODY>
</HTML>

Or as voets said, make a function that calls both of those functions and call that function onLoad

El Phantom
September 8th, 2003, 03:19 AM
can't you just use a comma? As long as their in the same set of quotes, won't it work? I forget...

--EP

[m]
September 8th, 2003, 08:52 AM
Voetsjoeba's way:

<HTML>
<HEAD>
<TITLE>JS Test</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function A(){
MM_preloadImages('imagens/fav-on.gif','imagens/sug-on.gif','imagens/priv-on.gif','imagens/lk1-on.gif','imagens/lk2-on.gif','imagens/lk3-on.gif','imagens/lk4-on.gif','imagens/lk5-on.gif','imagens/lk6-on.gif','imagens/lk7-on.gif');
runmikescroll();
}
-->
</SCRIPT>
</HEAD>

<BODY onLoad="A();">

</BODY>
</HTML>