Swapping html divs using Javascript HideDIV and Display DIV

My code is working but I'm not sure what to do about browsers with

Page 1 of 1

2 Replies - 2754 Views - Last Post: 14 May 2008 - 10:13 AM

#1 michelle@urban  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 1
  • View blog
  • Posts: 309
  • Joined: 09-July 05

Swapping html divs using Javascript HideDIV and Display DIV

Post icon  Posted 13 May 2008 - 09:27 AM

This is in the head:
<script type="text/javascript" language="Javascript"><!--
function HideDIV(d) { document.getElementById(d).style.display = "none"; }
function DisplayDIV(d) { document.getElementById(d).style.display = "block"; }
//--></script>



This is in the body:

<div class="inner-right">
<ul>
<li><span onmouseover="DisplayDIV('retail');HideDIV('public'); HideDIV('consumer'); HideDIV('travel'); HideDIV('finance'); HideDIV('broadcast')"style="cursor:pointer">roll over text here</span></li>
</ul>



<h2>Retail</h2>	
<p>Appears on rollover of each sector above. Phasellus auctor malesuada metus. 
Quisque ac sapien. Integer tellus elit, vehicula eget, volutpat sed. In accumsan, dui et pharetra rhoncus, felis dolor vehicula velit, tincidunt dignissim tellus urna sit amet magna. Duis luctus massa et ante. Proin eu nisi a sapien viverra dapibus.</p>



I have several of these paragraphs to show on roll over.

I followed this tutorial: http://www.willmaste...er_div_swap.php

It all works well but when I disable the JS in the browser of course nothing displays. How do I go about using alternate content for people with no JS?

If somebody could point me in the right direction that would be great!

Is This A Good Question/Topic? 0
  • +

Replies To: Swapping html divs using Javascript HideDIV and Display DIV

#2 girasquid  Icon User is offline

  • Barbarbar
  • member icon

Reputation: 108
  • View blog
  • Posts: 1,825
  • Joined: 03-October 06

Re: Swapping html divs using Javascript HideDIV and Display DIV

Posted 13 May 2008 - 10:49 AM

Have the alternate content display, and then have some Javascript run in window.onload that will hide the alternate content.
Was This Post Helpful? 0
  • +
  • -

#3 michelle@urban  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 1
  • View blog
  • Posts: 309
  • Joined: 09-July 05

Re: Swapping html divs using Javascript HideDIV and Display DIV

Posted 14 May 2008 - 10:13 AM

Hi there,

Thanks for the suggestion you spurred me on a new search term which lead me to the following http://www.dhtmlgood...ow_hide_content which I've implemented and so my problem is sorted.

Cheers

Michelle
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1