Closed Thread Icon

Preserved Topic: Newbie needs help Pages that link to <a href="https://ozoneasylum.com/backlink?for=17798" title="Pages that link to Preserved Topic: Newbie needs help" rel="nofollow" >Preserved Topic: Newbie needs help\

 
Author Thread
Iphesos
Nervous Wreck (II) Inmate

From: Austria
Insane since: Jul 2000

posted posted 07-29-2000 13:23

Hi folks,

I need a little help on the JavaScrpit Rollover from Ozone. I modified it as I needed it, but well ... I made one or more mistakes because it doesn't work anymore. Can somebody tell me, what's wrong with it?

<!--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( "norm" , "news", "art", "film" );
buttons = new Array(8);
for (m=0; m<=7; m++) {
buttons[m] = new Image(); }
buttons[0].src = "norm1.JPG";
buttons[1].src = "norm2.JPG";
buttons[2].src = "news.JPG";
buttons[3].src = "info.JPG";
buttons[4].src = "hangnorm.gif"
buttons[5].src = "beschreibung.JPG"
buttons[6].src = "hangnice.gif"
buttons[7].src = "film.jpg" }

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! -->

Thanks,
Iph

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 07-29-2000 15:35

Not being a javascript guru, I notice that in line 12 you have a close bracket, and at line 20 you have another end bracket, these two end brackets have only 1 open bracket between them (line 11)


www.warmage.org

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 07-29-2000 15:39

You also might try taking out the line window.onerror=null;, and that should tell you where you are going wrong...I think. I actually know next to nothing about JavaScript, but it seems logical to me.




What's mine is mine, and what's yours is mine to - First Rule of a Dictatorship

Iphesos
Nervous Wreck (II) Inmate

From: Austria
Insane since: Jul 2000

posted posted 07-29-2000 15:54

WarMage> Thanks but I didn't modify these brackets ... and it doesn't work when I write another open bracket

Skaarjj> well, I did this before, yess, I did .. it said:

document.images[names[des]] has no properties

but ermm .. I don't know what to do with this information ... do you?

Iph

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 07-29-2000 17:06

Ok, I will give you the open and close brackets have nothing to do with anything.

well you just gave yourself the answer.

<a href="zero.html"
onMouseover="swap(0,2)"
onMouseout="swap(0,0)"><img src="zeroA.jpg" name="zero"></a>

is he example doc uses. notice the onMouseover and onMouseout. Those need to have the information. The origional function doesn't do anything on its own.

A little explaination. swap() does not do a darn thing. swap(0,2) changes from button[0] to button[2]. If you have this defined and it is still not working... then you are screwed and need to give a link to the page, so we can view the source.



www.warmage.org

Iphesos
Nervous Wreck (II) Inmate

From: Austria
Insane since: Jul 2000

posted posted 07-29-2000 18:55

Well, I think I did as you said but ... doesn't work at all, so I uploaded the whole page yet ... it is not really finished and I am sure there are loads of mistakes in it .. well, just look yourself
http://mercury.spaceports.com/~iphesos/try1.html

And by the way thanks for you helping

DocOzone
Maniac (V) Lord Mad Scientist
Sovereign of all the lands Ozone and just beyond that little green line over there...

From: Stockholm, Sweden
Insane since: Mar 1994

posted posted 07-29-2000 19:53

Hi there! Ok we have this line here:

names = new Array( "norm" , "news", "art", "film" );

These are all of the possible "DES"tinations you can change the images of. When we say "swap(0,1)", we are really asking to to change the image on the page number "0" (which would be the <img> named "norm") and put the image from the buttons array number "1" into it. Doea this make better sense? You've only got the options of choosing 0, 1, 2 or 3 for the "des" part of that swap call.

Your pal, -doc-

Iphesos
Nervous Wreck (II) Inmate

From: Austria
Insane since: Jul 2000

posted posted 07-29-2000 23:15

Wait, wait, wait ... does this mean I can not make more than two images move? If yes, what do I need to make 4 images move?

bitdamaged
Maniac (V) Mad Scientist

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

posted posted 07-30-2000 22:50

No I think what Doc is trying to say is that you have 4 images you are trying to change. You can then change them with any of the 8 in the second array. so when you put the numbers in the swap function you should not have a number higher than 3 in the first position. Remember an array starts with the 0 position not the 1 so you should have this swap(0-3,0-7) with the first number reffering to the names array and the sencond reffering to the buttons array.

You can see that in any of the swap functions where the first number is more than 3, those are the mouseovers that do not work.

I dunno if this makes sense, I would try to fix your code but I don't know what goes where

« BackwardsOnwards »

Show Forum Drop Down Menu