PDA

View Full Version : Javascript Function Load Order



wyclef
October 18th, 2005, 04:07 PM
How can I stop a JS Function from running before another function has had an opportunity to load and run if the one i don't want running first is loaded and called first?

senocular
October 18th, 2005, 04:59 PM
use onLoad in the body tag - that will execute when all content (functions) have loaded

wyclef
October 18th, 2005, 05:02 PM
can u give me an example of what this would look like?

senocular
October 18th, 2005, 05:14 PM
something along the lines of

<html>
<head>
<script src="functions1.js"></script>
<script src="functions2.js"></script>
</head>
<body onLoad="function1();">
<p>Hi.</p>
</body>
</html>

wyclef
October 18th, 2005, 05:25 PM
thx