Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

hopefully someone can assist me with this.

 

trying to make it so that when one div in my html page is hidden, another one is visible. tried this

 

function hideShow(first,second)

{

 

var div1 = document.getElementById(first).style;

var div2 = document.getElementById(second).style;

 

div1.display = div1.display? "block":"";

div2.display = div2.display? "":"block";

}

 

not sure how to proceed.

 

any help greatly appreciated.

 

thanks.

  • 9 months later...
Posted
function toggle(id)
{
  var div = document.getElementById(id);
  div.style.display = (div.style.display == "none") ? "inline-block" : "none";

  // you could also try this...
  // div.style.visibility = (div.style.visibility == "hidden") ? "visible" : "hidden";
}

function hideShow(first,second)
{
 toggle(first);
 toggle(second);
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...