how to not hide a division

R

richard

In using the simple code below, how do I tell it NOT to hide a
division when the link is clicked on if that division is already
visible?

would it be as simple as using a 2nd function and setting that to
"display" rather than "none"?

For instance, "home" is showing. The user clicks on "home".
I don't want the division to do anything at all.


function ShowHide(){

if (document.getElementById('hide2').style.display ==
document.getElementById('home1').style.display){
document.getElementById('hide2').style.display = "none";
} else {
document.getElementById('hide2').style.display =
document.getElementById('home1').style.display
}
}
 
S

SAM

Le 11/2/08 10:27 PM, richard a écrit :
In using the simple code below, how do I tell it NOT to hide a
division when the link is clicked on if that division is already
visible?

would it be as simple as using a 2nd function and setting that to
"display" rather than "none"?

For instance, "home" is showing. The user clicks on "home".
I don't want the division to do anything at all.


function ShowHide(){

if (document.getElementById('hide2').style.display ==
document.getElementById('home1').style.display){
document.getElementById('hide2').style.display = "none";
} else {
document.getElementById('hide2').style.display =
document.getElementById('home1').style.display
}
}

don't know too much what could be this 'division' ...

function ShowHide(){
var home = document.getElementById('home1').style;
var hide = document.getElementById('hide2').style;
hide.display = home.display==''? hide.display :
hide.display==''? 'none' : '';
}

function ShowHide(){
var hide = document.getElementById('hide2').style;
if(document.getElementById('home1').style.display != '')
hide.display = hide.display==''? 'none' : '';
}
 
D

Doug Gunnoe

don't know too much what could be this 'division' ...

I didn't see the term 'division' in regard to 'div' in HTML 4
specification, but I think that most assume that's what it means.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top