Forum Moderators: open

Message Too Old, No Replies

rollover/html errors

can anybody help...? (long explanation :)

         

ladytoad

7:37 pm on Mar 6, 2004 (gmt 0)

10+ Year Member


For the life of me, I cannot get my rollovers to work. I get an error message in the status bar, or nothing happens. I think its a problem with my html coding, but I can't figure it out. I've finally tried copying code directly out of a book, but that didn't work either.

Example:

<script type="text/javascript">
<!--
var News1 = new Image();
var News2 = new Image();
News1.src = "News1.gif"
News2.src = "News2.gif"
var Port1 = new Image();
var Port2 = new Imag();
Port1.src = "Port1.gif"
Port2.src = "Port2.gif"
//-->
</script>

Application of script...:

<td align=center valign=bottom bgcolor="#000000">
<a href="News.html">
<img src="News1.gif" alt="News and updates" width="46" height="21" id="news" border="0"
onmouseover="news.src = News2.src"
onmouseout="news.src = News1.src" />
</a>
</td>

This is the error from a validator, could this be the cause and if so, how can I fix:

onmouseout="news.src = News1.src" />
Warning: net-enabling start-tag; possibly missing required quotes around an attribute value

On Mozilla, first image works. On IE, nothing works. I don't get it. Please help?

grahamstewart

7:52 pm on Mar 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This can't be helping...

var Port2 = new [red]Imag()[/red];

ladytoad

7:58 pm on Mar 6, 2004 (gmt 0)

10+ Year Member


How true ;[smilestopper])

Fixed that, but still isn't working (I also checked through the rest of the document for any additional spelling errors.)

tedster

8:17 pm on Mar 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try putting the onmouseover and onmouseout attributes in the anchor tag, instead of the image tag.

<a href="News.html" onmouseover="news.src = News2.src"
onmouseout="news.src = News1.src">
<img src="News1.gif" alt="News and updates" width="46" height="21" id="news" border="0" />
</a>

ladytoad

8:27 pm on Mar 6, 2004 (gmt 0)

10+ Year Member



Works with first image only, on mozilla, on IE, nothing.

Same as before.

grahamstewart

8:40 pm on Mar 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Paste the html code for your second one.

tedster

9:20 pm on Mar 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You also may find this thread useful:

Bare Bones Roll-over script [webmasterworld.com]

If you work with it, you will get a sense of how the javascript works instead of trying to type in the script by copying it.