Forum Moderators: open
So close with this one but just can't quite get it right. I have a simple 2 column page, nav buttons on the left and text on the right, couldn't be simpler (all built in CSS)
I want the text on the right to be replaced as the user clicks each nav button. Each text has it's own div.
I can easily hide the first div on click using the following js:
function RemoveContent(d) {
document.getElementById(d).style.display = "none";
}
but how do I make the next text div appear in it's place? I would normally use js here:
function InsertContent(d) {
document.getElementById(d).style.display = "";
but I want it to set the first div to display:none
and set the second div to display:"" all at the same time...
I bet this is real simple, hope so!
Franco_UK
...Proud owners of the worst cricket team in the world...
Just put both lines in the same function, with a slight modification, as follows.
function SwapContent( old, new) {
document.getElementById( old).style.display = "none";
document.getElementById( new).style.display = "";
}
Not sure if
display = "";will work though, might have to use
display = "block";