Leon945
01-08-2007, 05:19 PM
Hi all...
I have a little problem.
I want to be able to detect when the user moves away from the current active browser window.
The reason i want to do this is because i have a dhtml menu which remains open no matter what.
so this is what i want to do..
window.onblur=function(){
menuBar.closeAllMenus();
}
but the code isnt executed when i move away from the window!
can someone help me with this?
i've also tried this:
window.onblur=function(){
window.alert("AH!");
closeMenus();
}
function closeMenus(){
window.alert("IN");
menuBar.closeAllMenus();
}
</script>
</HEAD>
<body topmargin="0" leftmargin="0" onblur="closeMenus()">
and its not working
I cant post the whole menu code because its VERY long, but i know the
menuBar.closeAllMenus() instruction works.. i've tried it with
function closeMenus(){
menuBar.closeAllMenus();
}
setInterval(closeMenus,1000);
and sure enough every second all the menus are closed.
is there another way to know if the user is leaving the window?
right now the page is divided into 2 frames, im working with the top frame where the menu is.
does that affect the behaviour of window.onblur ?
I have a little problem.
I want to be able to detect when the user moves away from the current active browser window.
The reason i want to do this is because i have a dhtml menu which remains open no matter what.
so this is what i want to do..
window.onblur=function(){
menuBar.closeAllMenus();
}
but the code isnt executed when i move away from the window!
can someone help me with this?
i've also tried this:
window.onblur=function(){
window.alert("AH!");
closeMenus();
}
function closeMenus(){
window.alert("IN");
menuBar.closeAllMenus();
}
</script>
</HEAD>
<body topmargin="0" leftmargin="0" onblur="closeMenus()">
and its not working
I cant post the whole menu code because its VERY long, but i know the
menuBar.closeAllMenus() instruction works.. i've tried it with
function closeMenus(){
menuBar.closeAllMenus();
}
setInterval(closeMenus,1000);
and sure enough every second all the menus are closed.
is there another way to know if the user is leaving the window?
right now the page is divided into 2 frames, im working with the top frame where the menu is.
does that affect the behaviour of window.onblur ?