1
well I declared a function in a javascript file
javascript file:
window.onload = function(){
function func(x,y){
//faz operacoes em x e y e nao retorna nada
}
}
however in the html file,when I want to call this function passing the parameters x and y
html file:
<script type="text/javascript">
func(2,3);
</script>
he error in html file saying that the function is undefined,I’ve tried to do something like
<script type="text/javascript">
window.onload = function() {
func(2,3);
}
</script>
just that it will not,it error even so saying that I did not declare the function,however I declared the function in a separate js file,does anyone know how to solve this problem? I appreciate anyone who can help
note:I’m using global variables, in addition to the fact that my algorithm is too big to put in html,so if you could tell me a way to pass the parameters of a javascript function in html it would help me a lot
I don’t understand why
window.onload
in js file, use this in html.– Maurivan
What is the order of scripts in HTML?
– Jéf Bueno
now the same order you are seeing
– ReZ