Advertisement:

JavaScript onMouseOut help...

Aloittaja Aquilo, maaliskuu 22, 2007, 06:54:47 IP

« edellinen - seuraava »

Aquilo

Please! ;)


ok I have an image that has an onMouseOver placing a <div> over it, and this <div> has three "child" images in it, what I was doing before the images with onMouseOut was just fine but now with the images if I go over one of them the <div> hides how can I make the images in the <div> keep it shown as well?

here is a better example
<div id="imgholder" onmouseover="FrameOn(this,'imageframe');"><img src="base.img" /></div>
<div id="imageframe" onmouseover="FrameOff('imageframe');"><img src="1st.img" /><img src="2nd.img" /></div>

so what I found is waving the mouse over 1st.img & 2nd.img will make imageframe hide!

how do I keep imageframe open when the mouse is over 1st.img & 2nd.img??

Thanks for any help!
Aquilo

B Patterson

That's because of inheritance!!!  The "imageframe" div will hide any time the mouse is moved over it.  To counteract this, you need to either remove the onmouseover function from the imageframe div, or add a button, and make it an onclick event.

Aquilo

the onmouseover on imageframe was a typo it should be

<div id="imgholder" onmouseover="FrameOn(this,'imageframe');"><img src="base.img" /></div>
<div id="imageframe" onmouseout="FrameOff('imageframe');"><img src="1st.img" /><img src="2nd.img" /></div>


the typo is only here in the example!

shouldn't the two images inherit onmouseout function from imageframe?

Aquilo

funny thing is it does not hide if there is text you can select text and it will not hide until the mouse is out of  imageframe but adding images does not do this!

B Patterson

Are you adding straight text like:
<div id="imageframe">this is example text</div>

or like this:
<div id="imageframe"><p>some text...</p></div>

If it's the first, that's because the text is on the same level as the div, so it never leaves that div.  In the second, it's another layer, and a new div, so the mouseout fires.

What might be the best idea is to add a button, and use an onClick or onMouseUp function to fire that calls the frameOff() function.

<div id="imageframe"><img /><img /><img />
<a href="javascript:void(0);" onClick="FrameOff('imageframe');">Close</a>
</div>

Aquilo

#5
well I found using javascript to do an imageframe.innerHTML type thing actually makes the images part of the imageframe layer! well that was just a test so off to see if it works! :D nope :(

Dannii

Firstly, don't use inline javascript ;)

Secondly, the best thing to do is probably to look at the event object and see what the target was.
http://www.quirksmode.org/js/events_properties.html
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Aquilo

I've got out all the inline javascript, still trying to get the mouse out to work! ;D

Advertisement: