View Full Version : NEWBIE: Whats this Java Called?

07-04-2002, 07:25 AM
Put your mouse over dedicated server and the other link. It has some kind of roll over. But the imager stays in the same place while changing?
Can anyone link me to this java on a site or what it is called?

I am not talking about this kind of java, image swap.
http://www.hosting.com/dedicated.jsp at the top

thanks so much!!!

07-04-2002, 07:32 AM
okay what are you talking about??

When you click over those four things, it does 2 things
1) Changes link color...CSS a:hover
2)Image Swap done with javascript not hard

What do you want to know exactly??


07-04-2002, 07:47 AM
I want to make the same thing..but i don't know what that is called....
I want to make like cd button....then when the users puts his mouse over cds....in the box a picture of cd's will show...then when he puts his mouse over cs player..a cd player picture will appear in the same box....

07-04-2002, 08:25 AM
First off, there is no text in the link, it's an image, and only an image.

What they did (view Script under the "Navigations Table" Comment tag), is change the image source with JavaScript using the onmouseover and onmouseout JavaScript event handlers, which you can read more about Here (http://www.javascriptkit.com/javaindex.shtml), under the "Understanding Event Handlers" section.

And to do the stuff you want, you could use the <DIV> tag or do what it says in Accessing Images and Rollovers (http://www.javascriptkit.com/javatutors/image1.shtml) section.


If your new to JavaScript, the best place on the net(if you ask me) to go, is the www.wsabstract.com (Which is also the Administrator's) Web Site.
If your not, when you see something interesting, view it's source and then experiment with it, I find that helps in the understanding of JS(and HTML)...

07-04-2002, 09:05 AM
is this easy to a beginner? this source

07-04-2002, 09:34 AM
I don't Script for others often, but try this:

<A href="cds.html" onmouseover="function1(cds)"
onmouseout="function1(DEFAULT_PIC)"> //onmouseout returns Picture to DEFAULT, this may or may not be desired...
//don't actually insert a return carriage in the tags, I just did it for clarity
<A href="cdplayer.html" onmouseover="function1(cdp)"

//insert comment tags in SCRIPT if desired, but whatever

function function1(IMGNAME){
document.NAME.src=IMGNAME+".XXX" /*NAME and IMGNAME may have to be defined, I don't do this type of function often*/


PS: Welcome to dump(comment negatively) on this SCRIPT, All Input is welcome ;)

07-05-2002, 11:24 AM

the effect you're talking about could be done with a straight rollover function on one image place.

something like this:

mainImage = new Image();
image1 = new Image();
image2 = new Image();

mainImage.src = "someURL/mainImage.gif"
image1.src = "someURL/somePic.gif"
image2.src = "someURL/anotherPic.gif"

//the above ensures that all images and referenced and loaded into memory so that the function below knows what to change.

function changeImage(imagePlace,ImageName)
{ if (document.images)
{ document[imagePlace].src = eval(ImageName+".src") }

And then in the body of the HTML place your main image and give it a name - say <img name="mainImage" src="someImage.gif">

When you place the images that act as links, add the rollover code to onMouseOver and onMouseOut - something like this:

<A href="somelink.html" onMouseOver="changeImage('mainImage','image1')" onMouseOut="changeImage('mainImage','mainImage')>
<img src="someImage.gif">

<A href="somelink.html" onMouseOver="changeImage('mainImage','image2')" onMouseOut="changeImage('mainImage','mainImage')>
<img src="anotherImage.gif">

The important point to note is that the image place value does not change - this means that the script will substitute a new image in the single location on the screen for whatever link is rolled over.

I hope that all made sense ...

good luck