Jump to content

how to? onmouseover reveal text


Steven

Recommended Posts

Okay, I'm not experienced with JS at all, so I don't know if this is even in the right forum! But this is what I want to do:http://www.theudo.net/mapNotice the three links at the bottom of that box area: Employers, Admins, and Brokers. What I want to happen is have a block of text that corresponds to each of those three areas appear after a mouse rollover. The headings for the three will be links to their own pages, but I want a snippet of info on the homepage. I want these text snippets to appear ONLY when the mouse is hovered over the headings. Would JS or Flash be better for this? In either case, how does it effect accessibility? I'd imagine Flash would definitely hurt the page's accessibility. As for where the text snippets are to be placed, I would like to have it appear either in the right-hand half of the image with the lake and boat; or below the headings in their own respective columns.Ideas? Thoughts? Oh, and if you believe JS to be the better route, how do I accomplish it? :)Thanks in advance!

Link to comment
Share on other sites

Something like this would work. You can put the divs wherever you want.

<script type="text/javascript">function show_text(id){  document.getElementById('text1').style.display = "none";  document.getElementById('text2').style.display = "none";  document.getElementById('text3').style.display = "none";  document.getElementById(id).style.display = "block";}</script><div id="text1">text 1</div><div id="text2">text 2</div><div id="text3">text 3</div><a href="javascript:void(0);" onclick="show_text('text1');">Show 1</a><a href="javascript:void(0);" onclick="show_text('text2');">Show 2</a><a href="javascript:void(0);" onclick="show_text('text3');">Show 3</a>

Link to comment
Share on other sites

No, it will return an error. If you want to show something blank you'll have to add another <div> with nothing in it:<div id="text1">text 1</div><div id="text2">text 2</div><div id="text3">text 3</div><div id="blank">text 3</div><script type="text/javascript">show_text('blank');</script>Do you understand how the script works?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...