Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

checkbox / onclick / display: visible - none

Status
Not open for further replies.

kimera

MIS
Nov 6, 2000
15
0
0
CH
I'm looking for a way to make a layer (<div></div) disappear and visible by clicking on a checkbox. Unfortunately I always can execute 1 of them either 'visible' or 'none' work but not both of them. I used the script below 'onclick'

function CheckBoxes()
{
if(document.PrintManagerForm.Location.checked == true)
{testlayer.style.display = &quot;''&quot;;}
else
{testlayer.style.display = &quot;none&quot;;}
}

Did somebody run into the same problem
 
&quot;Unfortunately I always can execute 1 of them either 'visible' or 'none' work but not both of them&quot; --> you mean, when it has disappeared you can't make it appear again or you have 2 layers and can only play with one of them ??
if it's the 2nd option then your layers have to have each a unique name
if it's the first one then
a- check the call to the function. you'd better use onchange than onclick !!!!!
b- try testlayer.style.visibility (=&quot;hide&quot; or &quot;show&quot;) instead of testlayer.style.display
c- just a detail, i guess won't fix anything, but it's muuuuuch more elegant to write : if(document.PrintManagerForm.Location.checked)
(just the same as ==true but ... more elegant !)



 
thanks Iza.

Unfortunately id didn't work.

a. onchange doesn't work at all
b. it has to be display because other text has to move up (anyway visibility come up with the same result. I can hide it but no visible or reverse)
c: thanks

any other ideas?

however, thanks for your help. I appreciate.
greetings from Switzerland.

Brayan
 
a- i checked out and you're right, onchange isn't supported, so you have to use onclick - sorry i tought is was !
b- ok to use display, try testlayer.style.display = &quot;block&quot; when checked (instead of &quot;''&quot;)
c- you're welcome, but as i looooOOOOooove swiss chocolate, can you send me some ;-) !!!!!
 
I LOOOOOOOOOOOOVE YOUUUUUUUUUUUUUUUUUUUUU! You are just THE (WO)MAN! GREAT! how did you find out?

If you are Canadian I'll send you Swiss Chocolate for free!
 
I LOOOOOOOOOOOOVE YOUUUUUUUUUUUUUUUUUUUUU! You are just THE (WO)MAN! GREAT! how did you find out?

If you are Canadian I'll send you Swiss Chocolate for free!


Brayan
 
i just read the doc on devedge ... ;-)
i'm french, so i can go buying chocolates myself, don't worry for me ;-) !! (i'm in Paris but my parents are close to the Alps :]] and i've been living realllly close to Geneve !)
 
great.

bye the way.... if you have read a doc on that... is it possible to name several layers (<div></div> all on the same level) the same e.g. TestLayer, and then make them disappear using the block attribute? There must be a way to do so (I guess).

however, I don't want to claim info the entire day from you.

Thanks
Brayan
 
yes there is, i guess document.layers[&quot;TestLayer&quot;] will return an array and then you loop over the array and do whatever you want to ... unfortunatly i didn't memorize the url, but go to devedge doc, and search for the DHTML one, you might find what you need - hopefully !
have a nice day (and go skiing, it's nearly night, it'll be too late !!!)
 
devedge doc

would you mind to let me know where that is?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top