By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,831 Members | 1,024 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,831 IT Pros & Developers. It's quick & easy.

how to not hide a division

P: n/a
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
}
}
Nov 2 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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' : '';
}

--
sm
Nov 2 '08 #2

P: n/a
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.
Nov 3 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.