How come javascript onfocus and onblur events do not fire in IE more then once?
-
Could someone tell me why the onfocus and onblur events only fire once. For example, using the code below, when you bring IE to the foreground the onfocus event fires and when you click on another windows (outside of that instance of IE) the onblur event fires, very good. But I can not get it to fire again, unless I reload the code. I expected these events to keep firing for each time the browser gets and loses focus. Is there something I'm missing or is that just a limitation of IE v7? Here is a sample test: function lostfocus() { document.write("lostfocus\n") } function gotfocus() { document.write("gotfocus\n") } Thanks... Rick
-
Could someone tell me why the onfocus and onblur events only fire once. For example, using the code below, when you bring IE to the foreground the onfocus event fires and when you click on another windows (outside of that instance of IE) the onblur event fires, very good. But I can not get it to fire again, unless I reload the code. I expected these events to keep firing for each time the browser gets and loses focus. Is there something I'm missing or is that just a limitation of IE v7? Here is a sample test: function lostfocus() { document.write("lostfocus\n") } function gotfocus() { document.write("gotfocus\n") } Thanks... Rick
here's a better example function lostfocus() { document.getElementById("displayFocus").innerHTML = "lostfocus\n"; } function gotfocus() { document.getElementById("displayFocus").innerHTML = "gotfocus\n"; }
your problem was your use of document.write