I am using
<body marginheight='0' topmargin='0' leftmargin='0' onLoad='setFocus()'>
and in javascript I am using
<script language='JavaScript'>
function setFocus(){
alert("Hello");
document.frm.txtName.focus()
}
</script>
this is not working in IE but working perfectly in FF and chrome browsers
any idea please?
Try to change
document.frm.txtName.focus()todocument.forms[0].txtName.focus(). This will work in IE.Make shure that your
<form name="frm">is the first form on page. I.e: before this form shuldn’t be any other<form>elements in document.If you can’t do that just add the
idattribute to the yourtxtNametext field. For example :And in your function
setFocuswrite: