Using JavaScript to change a CSS

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Using JavaScript to change a CSS

Post by nigma »

Hey, I am using javascript to hide / unhide div boxes. I do:
document.all.DivBoxName.style.visibility = "value"; // If IE
document.getElementById("DivBoxName").style.visibility = "value";

I tried doing the same thing just changing visibility to a diff property but it wont work. Anyone know why? besides a lack of knoledge on my part ;)?
User avatar
Friday
Forum Newbie
Posts: 5
Joined: Wed May 21, 2003 4:16 am
Location: China

Post by Friday »

this? :)

Code: Select all

<input type="button" value="click" onclick="with(a.style) visibility==''?visibility='hidden':visibility=''">
<div style="background:#99CC00" id="a">I'm div</div>

<input type="button" value="click" onclick="with(b.style) display==''?display='none':display=''">
<div style="background:#99CC00" id="b">I'm div too</div>
Post Reply