Closed Thread Icon

Preserved Topic: rollovers don't work all??? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=17830" title="Pages that link to Preserved Topic: rollovers don&amp;#039;t work all??? (Page 1 of 1)" rel="nofollow" >Preserved Topic: rollovers don&#039;t work all??? <span class="small">(Page 1 of 1)</span>\

 
Rinswind 2th
Maniac (V) Inmate

From: Den Haag: The Royal Residence
Insane since: Jul 2000

posted posted 08-16-2000 04:01

Ok here is my problem:
I'am making an interface with 9 buttons which would light up when the mouse moves over.
the interface
I did Rollovers on button 1 - 4 but it only works on button 1&2

Here is the code
<SCRIPT LANGUAGE="JavaScript">

<!--DocOzone's Javascript code, copyright 1998
// Feel free to borrow and modify this code,
// but be sure leave this credit in the source!
// Your pal, -Dr. Thaddeus Ozone-
// .http://www.ozones.com/

window.onerror=null;
// that was to turn off error reporting...

if (document.images) {
names = new Array( "een" , "twee" , "drie" , "vier" , "vijf" , "zes" , "zeven" , "acht" , "negen" , "tien" );
buttons = new Array(8);
for (m=0; m<=7; m++) {
buttons[m] = new Image(); }
buttons[0].src = "b4.gif";
buttons[1].src = "b5.gif";
buttons[2].src = "b4_on.gif";
buttons[3].src = "b5_on.gif";
buttons[4].src = "c4.gif";
buttons[5].src = "c5.gif";
buttons[6].src = "c4_on.gif";
buttons[7].src = "c5_on.gif";}

function swap(des,num) {
if (document.images) {
document.images[names[des]].src = buttons[num].src; }}

// close the comment tag, this hides the script from really old browsers! -->
</SCRIPT>


</HEAD>
<body bgcolor="#FAEBD7">
<CENTER>
<table border=1 bgcolor="#000000" cellpadding=0 cellspacing=0><td>
<TABLE border=0 cellpadding=0 cellspacing=0>

<TR>
<TD rowspan=7><img src="a1.gif" alt="" width=28 height=225 border=0></TD>
<TD colspan=5><img src="a2.gif" alt="" width=351 height=46 border=0></TD>
<TD rowspan=7><img src="a3.gif" alt="" width=35 height=225 border=0></TD>
</TR>

<TR>
<TD colspan=3><img src="b1.gif" alt="" width=239 height=30 border=0></TD>
<TD><a href="nul.html"
onMouseover="swap(0,2)"
onMouseout="swap(0,0)">
<img src="b4.gif" name="een" alt="" width=55 height=30 border=0></a></TD>
<TD>
<a href="een.html"
onMouseover="swap(1,3)"
onMouseout="swap(1,1)">
<img src="b5.gif" name="twee" width=57 height=30 border=0></a></TD>
</TR>


<TR>
<TD rowspan=2><img src="c1.gif" alt="" width=100 height=61 border=0></TD>
<TD rowspan=4><img src="c2.gif" alt="" width=99 height=122 border=0></TD>
<TD rowspan=4><img src="c3.gif" alt="" width=40 height=121 border=0></TD>
<TD>
<a href="twee.html"
onMouseover="swap(4,6)"
onMouseout ="swap(4,4)">
<img src="c4.gif" name="drie" width=55 height=30 border=0></TD>
<TD>
<a href="drie.html"
onMouseover="swap(5,7)"
onMouseout="swap(5,5)">
<img src="c5.gif" name="vier" width=57 height=30 border=0></a></TD>

yes this is some code from the handson section Thanks Doc.


See you soon on the darkside of the moon (when the Alchemists don't blow it up that is)

[This message has been edited by Rinswind 2th (edited 16-08-2000).]

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 08-16-2000 06:08

I'm no expert by any means, but I'm thinking i may have something to do with the fact that you list 10 names, but only 8 images. Just a possiblity.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 08-16-2000 18:26

No biggie your numbering is just a bit off. Just to be clear the first number in the swap function is the image to change according to the names array (Starting at "0") so since you only have done this for four buttons the first number should not be higher than 3 (0,1,2,3) here is the correct chunk of code:

<TR>
<TD colspan=3><img src="b1.gif" alt="" width=239 height=30 border=0></TD>
<TD><a href="nul.html"
onMouseover="swap(0,2)"
onMouseout="swap(0,0)">
<img src="b4.gif" name="een" alt="" width=55 height=30 border=0></a></TD>
<TD>
<a href="een.html"
onMouseover="swap(1,3)"
onMouseout="swap(1,1)">
<img src="b5.gif" name="twee" width=57 height=30 border=0></a></TD>
</TR>


<TR>
<TD rowspan=2><img src="c1.gif" alt="" width=100 height=61 border=0></TD>
<TD rowspan=4><img src="c2.gif" alt="" width=99 height=122 border=0></TD>
<TD rowspan=4><img src="c3.gif" alt="" width=40 height=121 border=0></TD>
<TD>
<a href="twee.html"
onMouseover="swap(2,6)"
onMouseout ="swap(2,4)">
<img src="c4.gif" name="drie" width=55 height=30 border=0></TD>
<TD>
<a href="drie.html"
onMouseover="swap(3,7)"
onMouseout="swap(3,5)">
<img src="c5.gif" name="vier" width=57 height=30 border=0></a></TD>
</TR>

hope it helps


Walking the Earth like Kane

Rinswind 2th
Maniac (V) Inmate

From: Den Haag: The Royal Residence
Insane since: Jul 2000

posted posted 08-16-2000 21:01

Thanks bitdamaged i really thought that the first number was from the images aray..

I know it should be something simple <img border=0 align=absmiddle src="http://www.ozones.com/forum/wink.gif">




See you soon on the darkside of the moon (when the Alchemists don't blow it up that is)

Rinswind 2th
Maniac (V) Inmate

From: Den Haag: The Royal Residence
Insane since: Jul 2000

posted posted 08-17-2000 01:48

Dammn...
can't get this rollovers right....
Button 1- 4 work as planned
but button 5& 6 don't !!1 the swap picture doesn't apear... and the first pict doesn't come back
here is the link : The doomed rollovers

BTW Buttons -7-8-9 are not yet activated.
Please Help!


See you soon on the darkside of the moon (when the Alchemists don't blow it up that is)

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 08-17-2000 02:03

Heh, you put parentheses instead of brackets in the buttons array (buttons(8) instead of buttons[8]


Walking the Earth like Kane

Rinswind 2th
Maniac (V) Inmate

From: Den Haag: The Royal Residence
Insane since: Jul 2000

posted posted 08-17-2000 02:29

mmmmm Shame on me.......
Thanks <img border=0 align=absmiddle src="http://www.ozones.com/forum/redface.gif">


See you soon on the darkside of the moon (when the Alchemists don't blow it up that is)

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 08-26-2000 15:55

Hey...don't feel bad over mistakes like that...anyone can make them. I've seen big level programs spend weeks pouring over and reverse engineering their code all because one bracket was missing or one inverted comma was to early in a statement.

ANYONE CAN DO IT




Don't make me come down there! - God

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 08-28-2000 19:28

No kidding I was just woking on a little site for work and the goddamn tables wouldn't line up right. Ended up I had spelled CELLPADDING wrong so the thing was defaulting to 2px. Bugged the shit out of me for days.


Walking the Earth like Kane

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 08-28-2000 20:02

Something that might have helped avoid that, bitdamaged, is one little thing I do whenever my tables mess up... set the border="1", just for a minute, so that you can see what's going on with the cells. Maybe that's something everyone does, maybe not. It's helpful, in any case.

« BackwardsOnwards »

Show Forum Drop Down Menu