Steven Posted June 24, 2008 Share Posted June 24, 2008 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 More sharing options...
justsomeguy Posted June 24, 2008 Share Posted June 24, 2008 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 More sharing options...
Steven Posted June 24, 2008 Author Share Posted June 24, 2008 Thanks, it's working mostly. When the page is initially loaded it has all three text's shown. Link to comment Share on other sites More sharing options...
justsomeguy Posted June 24, 2008 Share Posted June 24, 2008 You can add a line like this to display whichever one you want on load:<script type="text/javascript">show_text('text1');</script>That can go anywhere after the other code. Link to comment Share on other sites More sharing options...
Steven Posted June 24, 2008 Author Share Posted June 24, 2008 Would <script type="text/javascript">show_text(' ');</script> show a blank? That is what I'm going for. Link to comment Share on other sites More sharing options...
Ingolme Posted June 24, 2008 Share Posted June 24, 2008 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.