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
Post a Comment