I have <div id="htldiv" style="display:none; visibility:hidden"> info info info </div> and want to change the display from none to block and visibility to show (or whatever it needs to be). This is being controled by a check box, on check show and activate, uncheck hide and deactivate (so it doesn't push my page down) I am using the following javascript in a aspx page to do this but it isn't working quite right:
function hoteldivstuff(id) { var obj = document.getElementById(id); if (obj.style.visibility=="hidden") { obj.style.visibility = "visible"; document.getElementById("hoteldiv").style.display=="block"; } else { obj.style.visibility = "hidden"; document.getElementById("hoteldiv").style.display=="none"; } }
If i take the display out of the <div> this code will work, however when I put it in, it doesn't show the <div> any more...I am sure it has to deal with my document.getElementByID lines, but I'm not sure how to fix it up right. I googled a little, but I am completely dumb when it comes to JavaScript!!!!!!!!!! HELP!! (Please :-) )
This conversation is currently closed to new comments.
If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.
I need Javascript help with asp please ?!?
function hoteldivstuff(id) {
var obj = document.getElementById(id);
if (obj.style.visibility=="hidden") {
obj.style.visibility = "visible";
document.getElementById("hoteldiv").style.display=="block";
} else {
obj.style.visibility = "hidden";
document.getElementById("hoteldiv").style.display=="none";
}
}
If i take the display out of the <div> this code will work, however when I put it in, it doesn't show the <div> any more...I am sure it has to deal with my document.getElementByID lines, but I'm not sure how to fix it up right. I googled a little, but I am completely dumb when it comes to JavaScript!!!!!!!!!! HELP!! (Please :-) )