I am having problems getting the OnChnage Listener to work, if i position the script after the </form>
tag the listener works fine but if i place the script within the <head>
tags it fails to work.
On my site i can only have the script within the <head>
tags is there anything I can do to make the script runn within the <head>
tags?
in this configuration the script does not work
<head>
<script type="text/javascript">
if(window.addEventListener) {
document.getElementById('address').addEventListener('change', loadXMLDoc, false);
} else if (window.attachEvent){
document.getElementById('address').attachEvent("onchange", loadXMLDoc);
}
function loadXMLDoc(){
alert('worked');
}
</script>
</head>
<body>
<form>
<input id="address" name="address" type="text"/>
<input id="test" name="test" type="text"/>
</form>