I want to use the JavaScript select() function to highlight a text field on a form, but first I want to use a named anchor so the page will scroll to the proper section. The following code works pretty well in Firefox, (Unless you enter the same value twice,) but IE does not allow the highlighted text to be typed over (without a tab or a click) the second time the page loads. How can I work around this, or am I doing it wrong?
filename: Test.html
<HTML>
<HEAD>
<script>
function setFocus() {
document.AForm.AText.select();
}
</script>
</HEAD>
<BODY onLoad="setFocus();">
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<a name="ATag"></a>
<form name="AForm" id="AForm" action="Test.html#ATag" method="get">
<input type="text" name="AText" id="AText" value="Enter text here." >
<input type="submit" value="OK">
</form>
</BODY>
</HTML>