6/16/2011

How to change css padding property using javascript dynamically

Using Javascript we can change css value. Here I have written how to change the value of padding top, padding bottom, padding left, padding right differently. var ab = 20;
//To change Padding-top value write document.getElementById("div_Id").style.paddingTop = ab.toString()+"px" //To change Padding-left value write document.getElementById("div_Id").style.paddingLeft = ab.toString()+"px" //To change Padding-right value write document.getElementById("div_Id").style.paddingRight = ab.toString()+"px" //To change Padding-bottom value write document.getElementById("div_Id").style.paddingBottom = ab.toString()+"px"