October 23, 201213 yr Hello guys i'm a begginer in HTML/CSS scripting, the problem is that i added some scripts/functions, and i am supposed to add the following in the body tag : onload= "FunctionName()" this i was able to do easily, and the script worked fine, however the problem is that i'm trying to add a miltitude of scripts that are triggered onload it's like "FirstFunction()" 'SecondFunction()" ThirdFunction()" i tried to add them by repeating the onload signal and the result was that only the first function worked : onload="FirstFunction()" onload="SecondFunction()" if i tried to add them side by side like onload="Firstfunction()" "Secondfunction()" it returns with an error i'm totally clueless about what to do so i hope i'm gonna find some help in your forums thanks in advance
October 23, 201213 yr is this any use <body onload="func1(); func2();"> more info here http://www.htmlgoodies.com/beyond/javascript/article.php/3724571/Using-Multiple-Javascript-onload-Functions.htm
October 23, 201213 yr Author Actually that was exactly what i was searching for thanks for the help ELITE
October 24, 201213 yr Rather than use the archaic inline scripting, opt for the more friendly code: HTML: <html> <head><title>Title</title></head> <body> <!-- body --> </body> </html> <script type="text/javascript"> if(window.addEventListener) { window.addEventListener("load", initialise, false); } else { window.attachEvent("onload", initialise); } function initialise() { func1(); func2(); funct3(); // etc., etc. } </script> Edited October 24, 201213 yr by Sitesupplier
Create an account or sign in to comment