The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Image Mouse Rollover - reset
LucasD5
post Aug 5 2009, 10:12 AM
Post #1





Group: Members
Posts: 1
Joined: 5-August 09
Member No.: 9,336



Hello everyone. I'm having one small problem with my mouse rollover images. (I'm self-taught and learning as I go.)

I got my Image mouseover script from this site:
http://www.webdevelopersnotes.com/tips/htm...e_rollover.php3

And I've gotten it to work. Here's the script they give:

SCRIPT----------------------------
<script type="text/javascript">
<!--

function roll(img_name, img_src)
{
document[img_name].src = img_src;
}

//-->
</script>
END SCRIPT-------------------------

...and the html code they give....

CODE-------------------------------
<a href="somewhere.html"
onmouseover="roll('sub_but', 'movedown.gif')"
onmouseout="roll('sub_but', 'movetup.gif')">

<img src="moveup.gif" width="143" height="39" border="0"
alt="Move your mouse over me" name="sub_but" />

</a>
END CODE---------------------------

This is working fine. The only problem I'm having is that when I select one of the rollover links, then use the back button on my browser to return to the home page, the rollover image isn't reset. In other words, the "onmouseover" image still shows. Can I put in a script that resets it to the initial image?

Here's the site: http://www.providence-bc.com/

Any help is appreciated!

LD


User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Aug 5 2009, 10:52 AM
Post #2


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



This isn't about Markup, so I moved it to the Client-side Scripting forum.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Nicholas_Roge
post Aug 5 2009, 12:40 PM
Post #3





Group: Members
Posts: 2
Joined: 4-August 09
Member No.: 9,325



In the "<body>" tag, add onload="roll('sub_but', 'movetup.gif')".
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Frederiek
post Aug 5 2009, 01:00 PM
Post #4


Programming Fanatic
********

Group: Members
Posts: 5,146
Joined: 23-August 06
From: Europe
Member No.: 9



Actually, why use javascript in the first place? The link simply changes from text and background color which easily could be achieved in CSS.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 12:55 PM