PDA

View Full Version : How can I explain this...?


Quiet Storm
06-27-2002, 08:48 PM
The idea:

When the <BODY> of index.html is in focus (<BODY onFocus="...), I need to "light(this)" to a <DIV>.

When <BODY> of index.html is in blur (<BODY onBlur="...), I need "dark(this)" to a <DIV>.

How do I assign this effect from the BODY to the DIV?

Also, there is an iFRAME in the page. I need to make sure if someone clicks on the iFRAME, the index.html will still be in focus. I'm thinking if you click on the iFRAME it will set focus to itself and blur the index.html...

Can someone help me on this?

:confused:

joh6nn
06-27-2002, 08:53 PM
window.onfocus = function() {
dark(document.getElementById(divId));
}

window.onblur = function() {
dark(document.getElementById(divId));
}

i don't know what to tell you about the iframe. you'll have to play with it first, and see.

Quiet Storm
06-27-2002, 09:07 PM
I think I'm not quite getting it:

<SCRIPT>
window.onfocus = function() {
light(document.getElementById(mist));
}
window.onblur = function() {
dark(document.getElementById(mist));
}
</SCRIPT>

<DIV ID="mist" STYLE="background-color:#000000; width:100%; height:100%; filter:alpha(Opacity=0);position: absolute; bottom: 0px; left: 0px; z-index:1;">
&nbsp;
</DIV>

Like that?

adios
06-28-2002, 01:53 AM
hey, QS...

Gotta pass that id as a string; unless you're using light() & dark() elsewhere, might as well incorporate the whole thing:

onfocus = function() {
var el;
if (typeof document.all != 'undefined') el = document.all('mist');
else if (typeof document.getElementById != 'undefined') el = document.getElementById('mist');
if (el) el.style.whatever = whatever;
}

onblur = function() {
var el;
if (typeof document.all != 'undefined') el = document.all('mist');
else if (typeof document.getElementById != 'undefined') el = document.getElementById('mist');
if (el) el.style.whatever = whatever;
}

You're correct about the <iframe>; a number of things can fire a blur event on the window object even while its document content retains focus. Sometimes better to identify these bugs as they occur...

Quiet Storm
06-28-2002, 03:20 AM
I got it. I played around with several different options and these are the basics:


<DIV ID="mist"
STYLE="filter:alpha(Opacity=0);
background-color:#000000;
width:100%;
height:100%;
position: absolute;
bottom: 0px;
left: 0px;
z-index:2;"
onFocus="dark(mist);"
onBlur="light(mist);" >
&amp;nbsp;
</DIV>


I also have to have the onFocus and onBlur events in the body:

<BODY
BGCOLOR="tan"
MARGINWIDTH="0"
MARGINHEIGHT="0"
LEFTMARGIN="0"
RIGHTMARGIN="0"
BOTTOMARGIN="0"
TOPMARGIN="0"
onLoad="
this.focus();
window.status='Springfield DX - v6.0';
blurLinks();"
onselectstart="return false"
onselect="return false"
onFocus="dark(mist);"
onBlur="light(mist);">


It seems to work with just that.. suprised the code outta me! :D