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

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -