470,644 Members | 1,202 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,644 developers. It's quick & easy.

double mouseover or function

Why does this not work:

function flipon(){
if (!this.filters.flipH) this.style.filter = 'flipH';
this.filters.flipH.enabled = true;
}
function flipoff(){
this.filters.flipH.enabled = false;
}

with this:

<IMG SRC="../graphics/romoy/bad.jpg" width=350 height=233 alt=""
border="0" onmouseover="flipon()" onmouseout ="flipoff()">

This is ok:

<IMG SRC="../graphics/romoy/bad.jpg" width=350 height=233 alt=""
border="0" onmouseover="if (!this.filters.flipH) this.style.filter =
'flipH'; this.filters.flipH.enabled = true;" onmouseout
="this.filters.flipH.enabled = false;">

I would like to put it in a function to use it here too:
Or how can I put two mouseovers in this:

<area shape="rect" alt="" coords="45,100,78,123"
onMouseOver="photo.src='../graphics/romoy/bad.jpg'; return true;">

--

find clausen
www.photopress.dk
Jul 20 '05 #1
1 2257
Lee
find clausen said:

Why does this not work:

function flipon(){
if (!this.filters.flipH) this.style.filter = 'flipH';
this.filters.flipH.enabled = true;
}
function flipoff(){
this.filters.flipH.enabled = false;
}

with this:

<IMG SRC="../graphics/romoy/bad.jpg" width=350 height=233 alt=""
border="0" onmouseover="flipon()" onmouseout ="flipoff()">

Because "this" doesn't refer to the image except in the
event handler function. Your event handler needs to pass
that reference on to the functions that they call:

function flipon(thisImage){
if (!thisImage.filters.flipH) thisImage.style.filter = 'flipH';
thisImage.filters.flipH.enabled = true;
}
function flipoff(thisImage){
thisImage.filters.flipH.enabled = false;
}

with this:

<IMG SRC="../graphics/romoy/bad.jpg" width=350 height=233 alt=""
border="0" onmouseover="flipon(this)" onmouseout ="flipoff(this)">

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by richk | last post: by
9 posts views Thread by Kim | last post: by
1 post views Thread by giloosh | last post: by
reply views Thread by warner | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.