PDA

View Full Version : Run automaticly instead of button



PoisonedV
March 9th, 2007, 08:21 PM
I made a short script that runs on the press of an image... How can I make one that runs automatically?

icio
March 11th, 2007, 10:39 AM
Turn the script into a function, eg:

<script type="text/javascript">
function init() {
// Your code goes here
}
</script>
and then at the very bottom of your document, call the function

<script type="text/javascript">
init();
</script>

borrob
March 12th, 2007, 06:41 PM
I wouldn't use this ^^ in this way rather have a window onload function that's called when the page is loaded:
<script type="text/javascript">
window.onload = function()
{
init();
}
</script>