html - Link javascript function to Submit button -


this structure of html:

<html> <body> <head> ...    <script type='text/javascript' src="js/javascript.js"></script> </head> ... <button class="submit" onclick="submitted()">submit</button> </body> </html> 

my file directory desktop/project/. within project folder html file on own , there subfolder called js javascript.js exists.

within external js file goes this:

function submitted(){ ... subtask(variable) ... }  function subtask(param){ ... } 

within submitted() added alert('hello'); first thing , wouldn't trigger alert when refresh html page. doing wrong?

change <script> tag to:

<script type="text/javascript" src="js/javascript.js"></script> 

.. means "one directory above current directory".


Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -