I have a Javascript function as below:
function letMeGo(var1, var2, var3){
if(var1 == 1 && var2 == 1 && var3 == 1){
document.getElementById('goOn').href="goOn.php";
}
}
the variables are the return of other functions.
And I need it to be triggered by:
<a id="goOn" onclick="letMeGo(var1, var2, var3)">Go On</a>
it is not working unless I removed the variable in both, the link and the function.
How can i get it to work with them?
you have to affect the return of the other functions to global variables (example:
window.myvar1) and use them instead of your parametersvar1, var2, var3.I mean to not use any parameters in your function
letMeGoand inside it, replace var1 by its global variable equivalent, and so on for var2 and var3.