Forum Moderators: open
<input id="1a0" type="text" onFocus="select()">
function checkAnswer{
if(document.forms[0].elements[i].value == answer){
document.forms[0].elements[i].setAttribute("onFocus", "this.blur()");
}
}
This works great for netscape, but I was wondering what will work in IE. I've tried [document.forms[0].elements[i].onfocus="this.blur()"] and when I check the attribute, it says it has changed, but the functionality doesn't. Anyone have any ideas?
Thanks.
The best thing to do is to to change it as a JS property, in much the same way as you were doing (but the correct one :) ). This will work cross-browser:
document.forms[0].elements[i].onfocus = function(){this.blur()}