Forum Moderators: open

Message Too Old, No Replies

How to make self.focus() work in IE?

self.focus() not working in IE?

         

ywang

4:04 pm on Dec 18, 2003 (gmt 0)

10+ Year Member



Hi, everyone:

I put the following code with html file which make the window popup in front after 5 seconds if other windows over it, it is work fine with Netscape, but dosen't work for IE.

Anyone know how to make this functionality work for IE? I also tried to use window.focus().

Thanks you very much and have a good day!

<script language="JavaScript1.2" >
<!--

function TimerCallBack( ){
self.focus();
alert("The session will be expired ,please refresh your window.");
}

setTimeout("TimerCallBack( )",5000);

-->
</script>

bcolflesh

4:09 pm on Dec 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



self.focus() does work in IE - you could add it to the body tage, like this example from CodeLifter:

<body onBlur="setTimeout('self.focus()',500)">