/    Sign up×
Community /Pin to ProfileBookmark

hi all

i have a problem. i want to use mouse over function – the image change into another image, but… i need it to be like this: when mouse is over the image i want this very image and one more image in a different place of the page to change.
i tried to use this and chang it but i failed:

=============================================

part 1
===============================================

<script language=”javascript”>
<!–
a1=new Image(59,47)
a1.src=”http://yourimage.gif
a2=new Image(59,47)
a2.src=”http://yourimage.gif
//–>
</script>
<script>
<!–
function filter(imagename,objectsrc){
if (document.images)
document.images[imagename].src=eval(objectsrc+”.src”)
}
//–>

</script>
======================================================


part 2, put this where you want your button to show
=======================================================

<!– –>
<a href=”yoururl.htm”
onmouseover=”filter(‘img1′,’a2′); window.status=’Status Message’;return true;”
onmouseout=”filter(‘img1′,’a1’); window.status=”;return true;” onclick=”window.focus()”>
<img src=”yourimage.gif” name=”img1″ border=0 width=59 height=47></a>
<!– –>

thanks a lot for help

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@justinbarneskinOct 16.2009 — It would be better to abandon that code and use only ONE image.

The one image you use is actually two that you have combined side by side in PAINT.

Set your button or div with that image as background. Set style of height, width, overflow:hidden

onmouseover/onmouseout, call function to change the background position such like

bgp(this,x,y,more,arguments)
×

Success!

Help @tomojacobson spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...