views:

138

answers:

2

I have 2 functions on a seperate page that I am including of the header of the .html page. Under the part where I include it, I have this code: window.onload = func1;

I want to take that little snippet of code, and include it inside the included .js page which has the function in it, so essentially there will be the function, then right under that the window.onload thing. But when I do this, the code doesnt work, any ideas?

The code isnt the problem, if I do:

function alert1() {
alert("hi");    
}
window.onload = alert1;

Then it still doesnt show up because that is in the included .js page

<script type="text/javascript" src="menu.js"></script>
+1  A: 

Is this what you have? This actually works:

function func1(){
    alert('Works');
}

window.onload = func1;
Harmen
A: 

Whoops I fuond the answer, there was a javascript error or something making the function not parse, or somethig. sorry

David