javascript - Why is my function with parameter not working -
i new java script. , trying pass parameter function. onclick event not working:
my html file:
<!doctype html> <html> <head> <script src="t.js"></script> </head> <body> <input type="button" value="next step" onclick="symbol_won(x)" /> </body> </html> my js file is:
function symbol_won (symbol) { alert("gr"); }
because have not defined x variable.
define variable x like:-
var x = 'variable'; also put quotes while passing it.
onclick="symbol_won(x)"
Comments
Post a Comment