Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hovering image producing different text with css/java 1

Status
Not open for further replies.

rye8261

Technical User
Joined
Jul 6, 2003
Messages
359
Location
US
I am having a very hard time getting anything to work. First let me start by saying I'm not a css or java guru, I'm just trying this out.

Here is what I'm trying to do.

I want to display 2 images at the same time, then at the bottom have some text for both images. I only want to display the text for the second image if it was hovered over though and leave the first one as default. I need the text to stay down there so people can copy it even if they arent hovering over the image. So say you hover over image 2, the text changes to say image 2 and stats that way unless you hover back over image 1.

Does that make sense and can anyone help?

---------------------------------------
- Free General Web Directory, Free Web site submissions.
- Free General Web Directory, Free Web site submissions.
 
have a div for the text content.

<div id="imgtext">text for image 1 here by default</div>

on the image2 <img onmouseover="document.getElementById('imgtext').innerHTML = 'the text for image 2 hover';" />

and the same for image1



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
That is almost exactly what I need; however, it won't work correctly.

I need to be able to put the text inside of an <input/> tag and am not able to do it with the innerHTML function.

To get a better understanding what I'm trying to do, go here.

You will see two images, one for myspace and one for lostcherry. I'm trying to create the link text for the appropriate site by clicking or hovering on the site you want the code for.

Any other ideas?

---------------------------------------
- Free General Web Directory, Free Web site submissions.
- Free General Web Directory, Free Web site submissions.
 
if it is an input variable you want to change the content of then give the input tag an ID.

<input type="text" name="myinput" id="inputtext" value="value of the first image text to show as default" />

then use this on the image mouse overs

document.getElementById('inputtext').value='text for the image you are hovering over';

regards,
1DMF

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top