...

View Full Version : Problem with rollovers



New2JS
01-10-2003, 05:05 AM
I'm having trouble with the rollover effect , or onMouseover? Sorry, but I am new to this whole javascript thing... I want to change one image [linked] to another one when the mouse is hovering over it. I've searching numourus forums and some useful info but, without much knowledge for JS I didn't know how to edit. I even tried that wipper thing here, without luck.

Basicly what I want to do is change this (http://www.geocities.com/dr_montagues_research/articles.gif) to this (http://www.geocities.com/dr_montagues_research/articles.jpg). Thanks.

glenngv
01-10-2003, 07:33 AM
Don't look far :D
http://codingforums.com/showthread.php?s=&threadid=11673

New2JS
01-10-2003, 03:01 PM
Yeah I know I saw that before. I tried it, but I can't figure out how to edit it. I also tried the other 'methods' in the topic but I cant get anything to work correctly...I'm guessing that that you edit these parts?:

if (sn != "" && sn != null) {
img.n = new Image
img.n.src = img.src; <---here?


ect.....

then mabey in this area?

function soopaSwapOn() {
this.src = this.h.src;
}

function soopaSwapOff() {
here?-->this.src = this.n.src;
}

function soopaSwapDown() {
here?-->this.src = this.d.src;
this.temp = typeof(document.onmouseup) != 'undefined' && typeof(document.onmouseup) != 'unknown' ? document.onmouseup : "";
soopaSwapUp.img = this;
document.onmouseup = soopaSwapUp;
}

function soopaSwapUp() {
var ths = soopaSwapUp.img;
here?-->ths.src = ths.n.src;
if (ths.temp) document.onmouseup = ths.temp;


Sorry, I don't really know what to do but I have an Idea. I'll try messing around with it untill someone helps me with this. Thanks for the reply.

New2JS
01-11-2003, 12:05 AM
--bumping it to the top in hope of more replys--

Could somebody help me this one? Why wont it work, seems like it should to me. This is the farthest I've gotten with this effect. I see the image but, then when you mouseover it takes a second then it just turns into a red x...The image links are all correct. Help needed, lol!


<script language="JavaScript">
var articles=new Image();
var articles2=new Image();
articles.src="articles.gif";
articles2.src="rarticles.jpg";
</script>

<a href="index.html" onMouseOver="document.rollover.src=articles2.src"
onMouseOut="document.rollover.src=articles.src">
<img src="articles.gif" name="rollover" border="0">
</a>


Thanks...

Skyzyx
01-11-2003, 10:50 AM
This ZIP file has a fully working page/script with images to show you how it works. You will never, ever need to modify the script file. All you do is modify the attributes of the IMG tag...



<img src="original.gif" hsrc="hover.gif" dsrc="down.gif" />


Download the ZIP and read the files.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum