我有以下两个javascript函数:
1
showCountry()
2
showUser()
我想将它们放在外部“ .js”文件中
<a href="javascript:showCountry('countryCode')">countryCode</a>
<form> <select name="users" onChange="showUser(this.value)"> <option value="1">Tom</option> <option value="2">Bob</option> <option value="3">Joe</option> </select> </form>
调用这些函数的正确语法是什么?
像这样的代码
<html> <head> <script type="text/javascript" src="path/to/script.js"></script> <!--other script and also external css included over here--> </head> <body> <form> <select name="users" onChange="showUser(this.value)"> <option value="1">Tom</option> <option value="2">Bob</option> <option value="3">Joe</option> </select> </form> </body> </html>
希望对您有帮助。…谢谢