We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
What's the code for...; onLoad
Topic Started: Jan 1 2005, 10:19 AM (347 Views)
purge.exe
Member
[ *  *  *  * ]
How can I change the onload of a document using JavaScript?
For example: document.onload = doStuff();
It doesn't seem to be working. :(

Can you help?,
purge.exe
Offline Profile Quote Post Goto Top
 
Ben
Member Avatar
Quantum-locked when observed.

onLoad is used in the body command. Eg:

Code: HTML
 
<html>
<head>
<title>Stuff</title>
<script type="text/javascript">
function do_stuff() {
document.write("Stuff");
}
</script>
</head>
<body onLoad="do_stuff()">
<a href="http://google.ca">Click for more Stuff</a>
</body>
</html>


The onLoad command in the <body> tag will trigger the function do_stuff(), which will write the word "Stuff" to the page.
Offline Profile Quote Post Goto Top
 
chriz04
Member
[ *  *  * ]
true, but you can still use:

window.onLoad = d0_stuff();
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Technology Chat · Next Topic »
Add Reply