Definition :
It is a process of applying css dynamically then it is called as dynamic css.
Program 1 :
<html>
<head>
<script language=”javascript”>
function display()
{
a=document.getElementById(“demo”);
a.setAttribute(“style”,”color:red; background-color:green; width=100px; height=100px;”);
}
</script>
</head>
<body>
<div id=”demo”> HELLO WELCOME </div> </br>
<input type=”button” value=”First Button” onclick=”display()”/>
</body>
</html>
Program 2 :
<html>
<head>
<script language=”javascript”>
function display()
{
a=document.getElementById(“demo”);
a.style.color=”red”;
a.style.backgroundColor=”green”;
a.style.width=”100px”;
a.style.height=”100px”;
}
</script>
</head>
<body>
<div id=”demo”>HELLOWELCOME</div> </br>
<input type=”button” value=”first button” onClick=”display()”/>
</body>
</html>
Be First to Comment