|
|
Author |
Thread |
shocktreatement
Nervous Wreck (II) Inmate
From: Insane since: Apr 2001
|
posted 10-11-2002 17:33
I am having some difficulty with the javacript mouse over code.
I created this site: http://www.geocities.com/rollercomet/index.html
And on the side of this layout are options leading to other parts of the site. The images are suppose to change colour when your cursor hoves over the image. I am trying to use a mouseover script but it is obviously not working.
Can someone please tell me what is wrong with the script? Or in my coding? What should I do in order to fix this problem?
I don't know what to do.
--Shocktreatement--
"Didn't open the box,and what was it last time? Didn't know what the box was. And yet we do keep finding each other don't we. Perhaps your teasing us,are you teasing us? No games,no more teasing,time to play!"-Female Cenobite
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 10-11-2002 18:00
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 10-11-2002 18:06
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
shocktreatement
Nervous Wreck (II) Inmate
From: Insane since: Apr 2001
|
posted 10-11-2002 19:44
It is still not working...any other ideas?
Thanks for the help by the way. Appreciate it.
"Didn't open the box,and what was it last time? Didn't know what the box was. And yet we do keep finding each other don't we. Perhaps your teasing us,are you teasing us? No games,no more teasing,time to play!"-Female Cenobite
|
Slime
Lunatic (VI) Mad Scientist
From: Massachusetts, USA Insane since: Mar 2000
|
posted 10-11-2002 19:45
The eval function is 100% unnecessary here. This is why I discourage the use of eval; people start thinking that they need it when they don't.
document.images[name].src = name + "on.src";
will work fine. You might also try
document.getElementById(name).src = name + "on.src";
With setting the ID of the element instead of the Name. (This is a more recent method which is more standards compliant.)
But the reason it's not working right now is pretty clear:
<IMG NAME="comet7" SRC="comet_5x1.jpg" WIDTH="178" HEIGHT="30" BORDER="0" name="image1">
Just look at that tag and tell me what's wrong with it.
|
shocktreatement
Nervous Wreck (II) Inmate
From: Insane since: Apr 2001
|
posted 10-11-2002 20:02
Hmmmm...it is still not working...What could be wrong with it now?
I am using Netscape 4.7 browser, which may be the main problem. But I need this mouseover effect to work on this poor browser. This website is going to be presented in school, so I need this to work.
What else can I do to try to fix the problem?
"Didn't open the box,and what was it last time? Didn't know what the box was. And yet we do keep finding each other don't we. Perhaps your teasing us,are you teasing us? No games,no more teasing,time to play!"-Female Cenobite
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 10-11-2002 21:11
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
Slime
Lunatic (VI) Mad Scientist
From: Massachusetts, USA Insane since: Mar 2000
|
posted 10-11-2002 21:21
Actually, I think he fixed that problem. Now It's working for me - no javascript errors - but the image links are broken.
I think this is also what's happening in NN4 at this point: the code works, but the image URL's aren't correct. Are you sure you're setting them to the right image names? Do the images exist in the same folder as the HTML file?
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 10-11-2002 21:28
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
Slime
Lunatic (VI) Mad Scientist
From: Massachusetts, USA Insane since: Mar 2000
|
posted 10-11-2002 22:23
Then again, I forgot that sometimes my IE doesn't report errors for some silly reason to do with Visual Studio...
|
RoyW
Bipolar (III) Inmate
From: Insane since: Aug 2001
|
posted 10-11-2002 23:09
As InI said - this should work (maybe you had some other unrelated error when you tried this)
document.images[name].src = eval(name + "on.src");
But as Slime said eval is not needed but you would need this code
document.images[name].src = window[ name + "on"].src;
|
Slime
Lunatic (VI) Mad Scientist
From: Massachusetts, USA Insane since: Mar 2000
|
posted 10-11-2002 23:18
Oooooh! I misunderstood! I thought you were just concatenating a string. Yeah, try RoyW's code.
|
shocktreatement
Nervous Wreck (II) Inmate
From: Insane since: Apr 2001
|
posted 10-12-2002 05:12
Most of the problem has been fixed up. The hover images actually appear now...the only problem now is actually having the image change back to the original display.
Whenever I hover over the buttons, they do infact change, but once the cursor moves off the image, it stays the way it is without changing back.
How do I fix this? Any ideas?
"Didn't open the box,and what was it last time? Didn't know what the box was. And yet we do keep finding each other don't we. Perhaps your teasing us,are you teasing us? No games,no more teasing,time to play!"-Female Cenobite
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 10-12-2002 10:39
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
shocktreatement
Nervous Wreck (II) Inmate
From: Insane since: Apr 2001
|
posted 10-12-2002 18:43
Ah yes, it is the same. That is definitely a problem. Thanks InI
I tried changing the "on," to "off" on the off tag but it still doesn't seem to be working.
This is SO frustrating. Heh, any other ideas?
"Didn't open the box,and what was it last time? Didn't know what the box was. And yet we do keep finding each other don't we. Perhaps your teasing us,are you teasing us? No games,no more teasing,time to play!"-Female Cenobite
|
shocktreatement
Nervous Wreck (II) Inmate
From: Insane since: Apr 2001
|
posted 10-17-2002 19:35
Hmmm...the buttons stay hovered when the cursor hovers over them...how do I fix this? Do I need to add any new lines of code? There doesn't seem to be a specification for timing in the coding. What should I add?
"Didn't open the box,and what was it last time? Didn't know what the box was. And yet we do keep finding each other don't we. Perhaps your teasing us,are you teasing us? No games,no more teasing,time to play!"-Female Cenobite
|
RoyW
Bipolar (III) Inmate
From: Insane since: Aug 2001
|
posted 10-18-2002 05:51
simply change this
document.images[name].src = window[ name + "off"].src;
to this
document.images[name].src = window[ name ].src;
|