I have the following two javascript functions:
1
showCountry()
2
showUser()
I would like to put them in external ".js" files
1
<a href="javascript:showCountry('countryCode')">countryCode</a>
2
<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>
What is the correct syntax to call these functions?
srcin your script tag like this<script type='text/javascript' language='javascript' src='Path to your external js file'/>.document.getElementById('users').addEventListener('change', showUser, false);in a separate JavaScript file would be better thanonchange.