By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,600 Members | 1,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,600 IT Pros & Developers. It's quick & easy.

double mouseover or function

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.