|
All Scripts JavaScripts ASP Scripts Other Scripts
How
To: Dynamically change Font, Size, Color, Text....
One of requests that I had was
how to Dynamically change Color of the text and make the
text Bold. This was an interesting task
and this what I was able to do.
This is the code:
1. HEAD Section:
<SCRIPT language=JavaScript>
function ChangeCol(val)
{if(document.form1.checkit.checked)
{ ccolor.innerHTML="<font color=red><B>We are HAPPY
to see You Here!!!</B></font>";
}
else
{ ccolor.innerHTML="<font color=blue><i>Please come
Back Again!!!</i></font>";
}
}
< /SCRIPT>
|
2. BODY Section:
<body onLoad='ccolor.innerHTML="<font
color=black>Thank you for visiting HouseOfScripts!!!</font>"'>
<form name="form1" method="post" action="">
<input name="checkit" type="checkbox" id="checkit" value="checkbox" onClick="ChangeCol(this.value)">
<strong> Check it</strong> <br>
<div id="ccolor"></div>
</form>
</body>
|
|