topical media & game development
graphic-javascript-effect-tag-style-effect.htm / htm
<!-- TWO STEPS TO INSTALL CHANGE HTML TAG STYLE:
1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original: AJ Slackmeyer (ajslackmeyer@hotmail.com) -->
<script language="JavaScript" type="text/JavaScript">
<!-- Begin
function showNewColor() {
// setup vars
var defaultColor = "white";
var newColor = "#ff9999";
// other supported styles
// myElement.style.fontSize = "24px";
// myElement.style.fontFamily = "Verdana, Arial, Courier New";
// myElement.style.textDecoration = "underline";
// myElement.style.fontWeight = "normal";
// myElement.style.visibility=="hidden";
if((document.getElementById)&& (document.getElementById('tagID')!=null)) {
// Get a reference to the element
var myElement = document.getElementById('tagID');
// Check the element's style object and background property are available
if ((myElement.style)&& (myElement.style.backgroundColor!=null)) {
// Check the value of the property
if(myElement.style.backgroundColor == 'white'){
// change style to new color
document.getElementById('tagID').style.backgroundColor = newColor;
}else {
// change style to default color
document.getElementById('tagID').style.backgroundColor = defaultColor;
}
}else {
// This CSS property is not assigned or is not supported
return;
}
}else {
return;
}
}
// email bug fixes to ajslackmeyer@hotmail.com
// End --->
</script>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<BODY>
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original: AJ Slackmeyer (ajslackmeyer@hotmail.com) -->
<table id="tagID" style="background-color:white;" width="200" height="50" cellspacing="2" cellpadding="2">
<tr><td>
This content resides in a table although it could be any other html element.
</td></tr>
</table>
<br><br><a href="javascript:showNewColor();">Change Tag Style</a> </td>
<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 2.50 KB -->
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.