Forum Articles
  Welcome back Join CF
You are here You are here: Home | Forum | Javascript and image rollovers

You are currently viewing our boards as a guest which gives you limited access to view most of the discussions, articles and other free features. By joining our Virgin Media community you will have full access to all discussions, be able to view and post threads, communicate privately with other members (PM), respond to polls, upload your own images/photos, and access many other special features. Registration is fast, simple and absolutely free so please join our community today.


Welcome to Cable Forum
Go Back   Cable Forum > Computers & IT > General IT Discussion
Register FAQ Community Calendar

Javascript and image rollovers
Reply
 
Thread Tools
Old 04-06-2004, 13:16   #1
Millay
Inactive
 
Millay's Avatar
 
Join Date: Oct 2003
Location: Portsmouth
Age: 48
Posts: 1,689
Millay has reached the bronze age
Millay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze age
Send a message via MSN to Millay Send a message via Yahoo to Millay
Javascript and image rollovers

Hi all, im sure everyone and his cat knows how to do image rollovers, my problem is I want to dynaimcally change the name of the image I am changing, as I will be changing multiple images depending on where the users mouse is on the screen, just cant get my head around the code to make this work.. here is what i have done so far (it doesnt work).
<script=javascript>
arr_Number = ImageNumber.split("x");
document.all.xAxis.innerHTML = arr_Number[0];
document.all.yAxis.innerHTML = arr_Number[1];
ImgSourceName = "im" & arr_Number[0] & "x" & arr_Number[1]
ImgSourceName.src = "images/glassblockmouseover.jpg";
//document.write(arr_Number[0]);
//document.write(arr_Number[1]);
//alert('hello');
</script>

HTML for onew image is below.

<a href="glassinteractive.php?acc=1&down=1" onMouseOut="ImageChangerRestore()" onMouseOver="ImageChanger('1x1')"><img name="im1x1" src="images/glassblock.jpg" width="28" height="28" border="0"></a>



Hope this makes sense..
Millay is offline   Reply With Quote
Advertisement
Old 04-06-2004, 14:15   #2
Millay
Inactive
 
Millay's Avatar
 
Join Date: Oct 2003
Location: Portsmouth
Age: 48
Posts: 1,689
Millay has reached the bronze age
Millay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze age
Send a message via MSN to Millay Send a message via Yahoo to Millay
Re: Javascript and image rollovers

tehe I sorted it myself by swapping

ImgSourceName.src = "images/glassblockmouseover.jpg";

for

document.images[ImgSourceName].src = "images/glassblockmouseover.jpg";

Cheers
Millay is offline   Reply With Quote
Old 04-06-2004, 21:58   #3
Matth
Inactive
 
Join Date: Mar 2004
Services: BB:M, TV:XL, Phone:M, Loyalty
Posts: 2,516
Matth has reached the bronze age
Matth has reached the bronze ageMatth has reached the bronze ageMatth has reached the bronze ageMatth has reached the bronze ageMatth has reached the bronze ageMatth has reached the bronze ageMatth has reached the bronze ageMatth has reached the bronze ageMatth has reached the bronze ageMatth has reached the bronze ageMatth has reached the bronze ageMatth has reached the bronze ageMatth has reached the bronze ageMatth has reached the bronze ageMatth has reached the bronze ageMatth has reached the bronze ageMatth has reached the bronze ageMatth has reached the bronze age
Re: Javascript and image rollovers

http://www.alistapart.com/articles/sprites/
I was going to suggest this as an alternative

The examples
http://www.alistapart.com/d/sprites/ala-image3.html
http://www.alistapart.com/d/sprites/ala-blobs2.html

No preloading, and works even when javascript is disabled
Matth is offline   Reply With Quote
Old 04-06-2004, 22:33   #4
Richard M
Inactive
 
Join Date: Jun 2003
Location: Los Angeles, CA
Age: 47
Posts: 6,343
Richard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze array
Richard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze array
Re: Javascript and image rollovers

What Matth said.
I was going to suggest going the CSS route myself.
Richard M is offline   Reply With Quote
Old 05-06-2004, 00:09   #5
Millay
Inactive
 
Millay's Avatar
 
Join Date: Oct 2003
Location: Portsmouth
Age: 48
Posts: 1,689
Millay has reached the bronze age
Millay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze age
Send a message via MSN to Millay Send a message via Yahoo to Millay
Re: Javascript and image rollovers

Hey, im a bit old fashioned, so some css tricks would be good!

I basically, have a 15x15 wall that as your mouse goes over, the corresponding down and up bricks need to be highlited.

A bit like words table building with the blue blocks.

I know have everything working, apart from reversing the selection, so any input is really appreciated!

Many thanks
Andy
Millay is offline   Reply With Quote
Old 05-06-2004, 00:11   #6
Millay
Inactive
 
Millay's Avatar
 
Join Date: Oct 2003
Location: Portsmouth
Age: 48
Posts: 1,689
Millay has reached the bronze age
Millay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze age
Send a message via MSN to Millay Send a message via Yahoo to Millay
Re: Javascript and image rollovers

Can i just say thanks 4 the links... they proving intersting and probably how I want to play things

Thanks
Millay is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:29.


Server: lithium.zmnt.uk
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum