Jump to content

mouseovers - need help!!


gosu^

Recommended Posts

Hey guys, im new to these forums, also new to web designing (so be gentle) only been doing it for a month ish.ive found this bit of javascript for mouse overs... now this is the first time ive properly sat down and tried to self teach javascript - needless to say without luck.could anyone give me a a kind hand?

HTML Script <A href="whatever.html" onMouseover="imgOn('img1')" onMouseout="imgOff('img1')"><Img src="whatever.gif" width="127" height="74" alt="Pictures" border="0" name="img1"></A> Java script for a mouse rollover <script LANGUAGE=JAVASCRIPT> <!-- bName = navigator.appName; bVer = parseInt(navigator.appVersion); if ((bName == "Netscape" && bVer >= 3) || (bName == "Microsoft Internet Explorer" && bVer >= 4)) br = "n3"; else br = "n2"; if (br == "n3") { img1on = new Image(); img1on.src = "whateveron.gif"; img1off = new Image(); img1off.src = "whateveroff.gif"; } // Function to 'activate' images. function imgOn(imgName) { if (document.images) { document[imgName].src = eval(imgName + "on.src"); } } // Function to 'deactivate' images. function imgOff(imgName) { if (document.images) { document[imgName].src = eval(imgName + "off.src"); } } // --> </SCRIPT> 

now my img names are:buttonover.gif = mouseover button imgbuttonup.gif = mouse off imgbut i dont know where i need to change the script to suite me... could you give me a hand?cheers John

Link to comment
Share on other sites

I can understand the script :)

HTML code <a href="whatever.html" onMouseover="imgOn('img1')" onMouseout="imgOff('img1')"><Img src="whatever.gif" width="127" height="74" alt="Pictures" border="0" name="img1"></a>Java script for a mouse rollover<script type="text/javascript"><!--bName = navigator.appName;bVer = parseInt(navigator.appVersion);if ((bName == "Netscape" && bVer >= 3)  || (bName == "Microsoft Internet Explorer" && bVer >= 4))br = "n3"; else br = "n2";if (br == "n3"){ img1on = new Image();img1on.src = "whateveron.gif";img1off = new Image();img1off.src = "whateveroff.gif"; }// Function to 'activate' images.function imgOn(imgName){ if (document.images)  { document[imgName].src = eval(imgName + "on.src"); }}// Function to 'deactivate' images.function imgOff(imgName){ if (document.images)  { document[imgName].src = eval(imgName + "off.src"); }} //--></script>
Change the blue to what the image's target url is, where you want to be redirected to when clicked.Change the green to the source of your standard pic, the one that is not hovered and not mouseout.Change the red to whatever you image's path is, when you want it to be when hovered :) (buttonover.gif)Change the purple to what when you leave the image with your mouse. (buttonup.gif)I hope this helped you :(
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...