double mouseover or function

F

find clausen

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;">
 
L

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)">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top