View Full Version : help: mouse over an image changes text in specified table

07-29-2005, 11:27 PM
i've seen it done before and now that i want to do it myself, i've forgotten where i might leach the code...

i'm making a menu for a website, i'd like for a caption to change depending on which menu button the user hovers over. so, when the page loads, a caption below the menu will say "welcome to blah blah blah" and when the user hovers over a "vendors" button, the caption will change to "locate a distributor or buy from our online store".... and so on.

any ideas would be appreciated


07-30-2005, 10:19 AM
<script type="text/javascript">
var vendordesc = "Locate a distributor or buy from our online store.";
// ... insert more descriptions ... (HTML will work, but it must be valid. Escape quotes.)
function recaption(string) {
document.getElementById("caption").innerHTML = string;

<img src="..." onmouseover="recaption(vendordesc);" alt="Vendors"/>
<!-- ... more menu items ... -->

<p id="caption">Welcome to blah blah blah. Mouse over the items for a description.</p>