View Full Version : rollover help

jamie smith
03-16-2005, 11:35 PM

Ive set up a web page www.amalgam-models.co.uk/james/test2.htm that has css rollovers at the top. Then underneath the bottom box youll see a cross where an image hasnt loaded this is because i am currently playing with it.
Basically what happens is as you mouseover the rollovers in that box at the bottom it tells u what the image is in text. I did this using a double rollover in html where the text is saved as an image gif and is called up when u rollover the top image. What I want to know is if there is another way of doing it other than saving the text as gifs because ill have a lot of pages and it would be easier just to update the text in html or the css.

Any ideas would be greatly apprecited.


03-17-2005, 12:25 AM
cross posted: http://www.codingforums.com/showthread.php?t=54601

03-17-2005, 12:26 AM
Yes, you can do this without using a gif. Just put a <div> in place of the <img> you are replacing, and use a script something like this (as an example):

<title>new document</title>

<script language="JavaScript">

function setDescription(strText)
document.getElementById("objDescription").innerHTML = strText;



<a href="#" onmouseover="setDescription('This is the First Link');" onmouseout="setDescription('');">First Link</a> |
<a href="#" onmouseover="setDescription('This is the Second Link');" onmouseout="setDescription('');">Second Link</a>

<div style="position: relative;" id="objDescription"></div>

jamie smith
03-17-2005, 12:40 AM
Hi thanks for the reply, would it be possible to adapt this code to work so that the text appears when u mouseover a css rollover?

jamie smith
03-17-2005, 01:01 AM
Hi just to let u know I have been testing the code and it works brilliantly and its really simple. Thanks for the great solution youve helped me out loads,

03-17-2005, 01:06 AM
To my knowledge, no. Sorry.

03-17-2005, 09:36 AM
Please read the Posting Guidelines (http://www.codingforums.com/postguide.htm) concerning cross-posting; DO NOT post the same question in more then one forum.

Concerning the rollovers: yes, it is possible without JavaScript and using simple text. The text fragment needs to be a part of the element that's rolled over, and the :hover state can toggle the visibility of this text fragment on and off.
It has to be positioned absolutely to the desired location, though, but seeing your example this shouldn't be a problem.