Hi,
I am having some problem with focus() method.The focus() method is suppose to set cursor at the beginning of the textbox if the focus() is set to textbox.But this code is doing good in NS browser but the same code in IE the cursor is going after 'a'(which is default value of textbox) in onClick event.The same code is working properly in onLoad() event even in IE.I don't undestand why it is problem with onClick evnt.I need immediate help in this.
Here is the code:
<html><head></head><body onLoad="setFocus()">
<form name="myForm" method="POST">
<input type="text" name="blabla" size=20 value="a">
<input type="reset" name="change" onClick="setFocus()">
<script language="javascript">
function setFocus()
{
document.myForm.blabla.focus();
}
</script>
</form>
</body>
</html>
I am having some problem with focus() method.The focus() method is suppose to set cursor at the beginning of the textbox if the focus() is set to textbox.But this code is doing good in NS browser but the same code in IE the cursor is going after 'a'(which is default value of textbox) in onClick event.The same code is working properly in onLoad() event even in IE.I don't undestand why it is problem with onClick evnt.I need immediate help in this.
Here is the code:
<html><head></head><body onLoad="setFocus()">
<form name="myForm" method="POST">
<input type="text" name="blabla" size=20 value="a">
<input type="reset" name="change" onClick="setFocus()">
<script language="javascript">
function setFocus()
{
document.myForm.blabla.focus();
}
</script>
</form>
</body>
</html>