image rollovers

They have: 22 posts

Joined: May 2001

Please help - code is driving me mad!

I have a rollover script that is supposed to bring up the rollover image in a different cell in a table. But it's not working - when I preview it's not even bringing up any errors! I've pasted the script below:

<script language="JavaScript">
= 3 ) version = "n3";
if ( browserName == "Microsoft Internet Explorer" && browserVer >=4 )
version = "e4";
if ( version == "n3" || version == "e4" )
{ blank = new Image(106, 68);
blank.src = "../../../images/comms%20news/blank.jpg";
blank2 = new Image(106, 68);
blank2.src = "../../../images/comms%20news/blank.jpg";
about = new Image(106, 68);
about.src = "../../../images/comms%20news/about1.gif";
pubs = new Image(106, 68);
pubs.src = "../../../images/comms%20news/pubs1.gif";
info = new Image(106, 68);
info.src = "../../../images/comms%20news/info1.gif";
press = new Image(106, 68);
press.src = "../../../images/comms%20news/press1.gif";
marketing = new Image(106, 68);
marketing.src = "../../../images/comms%20news/marketing1.gif";
web = new Image(106, 68);
web.src = "../../../images/comms%20news/web1.gif";
ni = new Image(106, 68);
ni.src = "../../../images/comms%20news/ni1.gif";
scotland = new Image(106, 68);
scotland.src = "../../../images/comms%20news/scotland1.gif";
wales = new Image(106, 68);
wales.src = "../../../images/comms%20news/wales1.gif";
}
function rollover (imgname) {
if (document.images) {document[imgname].src = eval (imgname + "o.src"); }
}
function rolloff (imgname) {
if (document.images) {document[imgname].src = ".gif"; }
}
// -->
</script>
<script language="JavaScript">
0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i
</script>










<script language="JavaScript">

Keegan's picture

They have: 300 posts

Joined: Aug 2001

Where is the URL to this site.

I want to see the error first hand.

K

They have: 22 posts

Joined: May 2001

I can't post the URL as it's for my intranet at work. Also, it isn't coming up with any error problems but the rollover image isn't showing up either

Keegan's picture

They have: 300 posts

Joined: Aug 2001

Open the page in your browser and File Save As to a folder on your desktop saving the images with it.

Zip it up and e-mail it to me at REMOVED TO PROTECT THE MASSES

I will be able to see what is not working faster.

K

They have: 22 posts

Joined: May 2001

It's on its way"

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Hi,

quick glance guess: "%20"
Rename the dirs with underscore

Vinny

They have: 22 posts

Joined: May 2001

Hi Vincent,

That didn't make any difference - by the way are you also at SitePoint or are there two of you??

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Hi jo,

Yep, I've been cloned & recloned Laughing out loud

As I said at sitepoint (& would say at javascriptCity, if you had posted there), you have multiple versions of rollover scripts -- none of which you are calling. The "MM" code is (I believe) dreamweaver code. The rest from somewhere else. Check out the rollover tutorials at:

http://www.htmlgoodies.com
http://www.javascriptcity.com

The following makes no syntactical sense

onMouseOver = " blank.src = about.src; ....

the right side of an assignment (about.src) is supposed to be a 'value'; therefore, in this case it would have to be a string. For example, 'somepic.gif'
the left side of the assignment (blank.src) is supposed to be part of the DOM (document object model); therefore, that should be something like:
document.images['blank'].src
which is why you have rollover functions. So, the mouseover should actually look more like this:

onMouseover = "rollover('blank', 'about').....

Vinny

Where the world once stood
the blades of grass cut me still

They have: 22 posts

Joined: May 2001

I'm looking through those two sites and hopefully they'll help - I just need to slow down a bit and learn it properly!!

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Hi jo,

Good Laughing out loud Let me know how it goes -- post here; the people here are better than those at sitepoint Smiling

Vinny

They have: 22 posts

Joined: May 2001

Ok, spent all weekend on it - finally got it to work and my manager is now off my back!!

Thanks for your help

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Hi jo,

Glad you're another satisfied customer Laughing out loud

Vinny

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.