Page 1 of 1

Javascript rollover

PostPosted: Fri Jan 16, 2004 12:52 pm
by inkhana
OK, I was working on my site with the plan of putting some javascript image rollovers on it. This javascript was one that came with my HTML editor and goes like this:

<!-- START OF SCRIPT -->
<!-- For more scripts visit (URL omitted since the site's gone anyhow) -->
<SCRIPT LANGUAGE="JAVASCRIPT">
nav3=false;
/*If this is navigator 3*/
if((navigator.appName == "Netscape") && (navigator.appVersion.substring(0,1) >= "3"))
{
/*Set the flag*/
nav3=true;
/*prepare array of rollover images and click images*/
rollOver = new Array
/*LIST YOUR ROLLOVER IMAGES HERE*/
rollOver[0] = new Image(51,21)
rollOver[0].src="images/layout2_02unflash.gif"
rollOver[1] = new Image(51,21)
rollOver[1].src="images/layout2_02flash.gif"
/*******************************************************/
/* CEASE YOUR TAMPERING HERE! */
/*******************************************************/
}
/*If this is navigator 3, swaps image n on screen for image m in rollOver array*/
function rollSwitch(name,m)
{ if(nav3) { picSwap(name, rollOver[m]) }}
/*Swaps the image field in image object i1 for the image fields in image object i2. And vice versa*/
function picSwap(i1,i2){
var temp = i1.src
i1.src=i2.src
i2.src=temp}
// -->
</SCRIPT>



--------And here is how it was supposed to be activated in the webpage-----



<a href="jake"
onMouseOver="rollSwitch(document.hme,1)"
onMouseOut="rollSwitch(document.hme,0)" target="MainScreen">
<img src="images/layout2_02unflash.gif" border=0 NAME="hme"></a>

Now, assuming that my pics are indeed in the subdirectory /images/ and all files are layout02_*.gif (and that "jake" of course, is not really what goes there), can someone tell me why this script produces no effect at all in the page? (Not even an error) The whole layout consists of image slices within a table, and the cell in which the second part of the script went has a background image named layout02_2.gif.

Thanks!

PostPosted: Fri Jan 16, 2004 1:58 pm
by Mithrandir
inkhana wrote:
<a href="jake"
onMouseOver="rollSwitch(document.hme,1)"
onMouseOut="rollSwitch(document.hme,0)" target="MainScreen">
<img src="images/layout2_02unflash.gif" border=0 NAME="hme"></a>



Hmm. I don't see a semicolon at the end of your javascript command. Is this on purpose? Also, I usually recommend the onmouseover not be capitalized. Some browsers reportedly have issues with it. Let me know if this doesn't work, k?

PostPosted: Fri Jan 16, 2004 3:32 pm
by inkhana
Oldphil helped me fix it...^^ Thank you!

PostPosted: Fri Jan 16, 2004 5:54 pm
by Mithrandir
And an elegent solution 'twas! If anyone else ever wants to do this, just copy the code to update the graphic name directly into the "onmouseover" lines.

- OldPhil.

PostPosted: Sat Jan 17, 2004 9:22 am
by inkhana
http://steelblood.christianmanga.com/v2/layoutoldphil.html

Here's the aforementioned layout - I just wanted to make sure that things were working the way they were supposed to on multiple browsers. Would those who have time mind taking a look and seeing if the layout appears broken (or if anything else looks crazy)? Also, all the little circles should light up when touched with the mouse (the first time it takes a just a sec to happen though). I'd also appreciate any critique on the layout...:) I don't do this very often but I'm trying to get better at designs and such. Oh! And one more thing. All of the links will 404 if you click them, because I haven't designed the new pages to go with them yet. There should, however, be a page that loads within the frame on the right.

Thanks!

PostPosted: Sat Jan 17, 2004 9:24 am
by ShiroiHikari
Looks good, Ink ;D

PostPosted: Sat Jan 17, 2004 10:29 am
by madphilb
Looks sharp.

I'm guessing that the graphical links on the side aren't all done yet (as in they don't have a link to them or the rollover).

BTW - viewd it with Firebird.... looked fine.

PostPosted: Sat Jan 17, 2004 10:35 am
by inkhana
Yeah...I thought I made the links last night but oh well...^^;;; It was about two in the morning anyhow...:P But so far everyone who has looked at it says the layout seems to be free of bad glitches...so far so good...*hopes* Thanks!

PostPosted: Sat Jan 17, 2004 3:54 pm
by wiggins
That's really beautiful! I've never made a website in my life, but if I were to do so, I would want to make one like that!