Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I start a set of javascript code startup of a website (a function heading, onload or something)


What I have tried:

function onload(){

}

I know there exists a piece of code that does this function. I just have not found it yet.
Posted
Updated 7-Feb-17 22:55pm

 
Share this answer
 
Comments
teledexterus 8-Feb-17 4:14am    
I looked thru there I could not find a function that is an onload function.
Richard MacCutchan 8-Feb-17 4:30am    
Please make an effort to look a bit harder: http://www.w3schools.com/jsref/event_onload.asp.
Try there: JavaScript Events[^]
Good tutorial site: W3Schools Online Web Tutorials[^]
 
Share this answer
 
Comments
teledexterus 8-Feb-17 4:28am    
Just looking for a simple piece of code. The Site is information though.
Are you looking for me[^]
+++++[round 2]+++++
It is just a generic term that refers to a JavaScript object which can be any HTML element. So it depends. Let borrow the example from Tryit Editor v3.3[^]
document.getElementById("myFrame").onload = function() {myFunction()};

The object refers to the iframe element in the html document identified by id="myFrame". In JavaScript, this is selected via
document.getElementById("myFrame")
. The onload event will be triggered when the object, that is the iframe in this case, has been loaded.
 
Share this answer
 
v3
Comments
teledexterus 8-Feb-17 4:36am    
object.onload = function(){
Javascript code
}
This is what I was looking for except What does the "object" stand for?
Peter Leow 8-Feb-17 5:13am    
added in my solution.
I used the body solution:

<body onload = "Startupfunction()">

    function Startupfunction(){
        \\Javascript Code
    }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900