feri_soft Posted January 17, 2007 Share Posted January 17, 2007 How to check a checkbox value with js and if it equals to a certain value to make the visibility of another div tag hidden...Solution needed very fast... :-\ Quote Link to comment https://forums.phpfreaks.com/topic/34596-checkbox-value/ Share on other sites More sharing options...
paul2463 Posted January 17, 2007 Share Posted January 17, 2007 i wrote this function for another site, I hade a checkbox call "col" for collection and one called "del" for delivery becuase you canonly have one or the other this function deselctecs one if the other one is clicked and vice versa, it may help you wioth your codeing[code]function swapColDel(){if (document.getElementById("col").checked == true){ document.getElementById("del").checked = false }if (document.getElementById("del").checked == true){ document.getElementById("col").checked = false }} [/code] Quote Link to comment https://forums.phpfreaks.com/topic/34596-checkbox-value/#findComment-163046 Share on other sites More sharing options...
feri_soft Posted January 18, 2007 Author Share Posted January 18, 2007 Yes its useful but instead of checked i want to change the style of a div tag so for exemple to be:style="visibility:hidden;" Quote Link to comment https://forums.phpfreaks.com/topic/34596-checkbox-value/#findComment-163741 Share on other sites More sharing options...
paul2463 Posted January 18, 2007 Share Posted January 18, 2007 Hi Feri Have a look herehttp://www.xulplanet.com/references/elemref/ref_checkbox.htmlit gives you all the attributes of the checkboxes Quote Link to comment https://forums.phpfreaks.com/topic/34596-checkbox-value/#findComment-163761 Share on other sites More sharing options...
mainewoods Posted January 18, 2007 Share Posted January 18, 2007 to change your visibility style, use a format like this:[code]document.getElementById('idname').style.visibility = 'hidden';ordocument.getElementById('idname').style.visibility = 'visible';[/code] Quote Link to comment https://forums.phpfreaks.com/topic/34596-checkbox-value/#findComment-163769 Share on other sites More sharing options...
bibby Posted January 22, 2007 Share Posted January 22, 2007 .style.visibility is less browser compatible than.style.display ([none|inline|block]) Quote Link to comment https://forums.phpfreaks.com/topic/34596-checkbox-value/#findComment-165982 Share on other sites More sharing options...
mainewoods Posted January 22, 2007 Share Posted January 22, 2007 you can also do:[code]object.style.display = ''; // causes object to display at whatever is the default display format for that object.[/code] Quote Link to comment https://forums.phpfreaks.com/topic/34596-checkbox-value/#findComment-166016 Share on other sites More sharing options...
fenway Posted January 22, 2007 Share Posted January 22, 2007 [quote author=bibby link=topic=122834.msg510149#msg510149 date=1169426108].style.visibility is less browser compatible than.style.display ([none|inline|block])[/quote]They do totally different things. Quote Link to comment https://forums.phpfreaks.com/topic/34596-checkbox-value/#findComment-166667 Share on other sites More sharing options...
worldworld Posted January 23, 2007 Share Posted January 23, 2007 I think you just have to use style.visibility:visible when the values are same. Quote Link to comment https://forums.phpfreaks.com/topic/34596-checkbox-value/#findComment-167087 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.