Working with the className Property : HTML CLass Style : HTML JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » HTML » HTML CLass Style »

 

Working with the className Property





/*
JavaScript Bible, Fourth Edition
by Danny Goodman 

John Wiley & Sons CopyRight 2001
*/

<HTML>
<HEAD>
<TITLE>className Property</TITLE>
<STYLE TYPE="text/css">
.special {font-size:16pt; color:red}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
function toggleSpecialStyle(elemID) {
    var elem = (document.all? document.all(elemID: document.getElementById(elemID)
    if (elem.className == "") {
        elem.className = "special"
    else {
        elem.className = ""
    }
}
</SCRIPT>
</HEAD>
<BODY>
<H1>className Property Lab</H1>
<HR>
<FORM NAME="input">
<INPUT TYPE="button" VALUE="Toggle Class Name" onClick="toggleSpecialStyle('head1')">
</FORM>
<BR>
<H1 ID="head1">ARTICLE I</H1>

<P>Congress shall make no law respecting an establishment of religion, or
 prohibiting the free exercise thereof; or abridging the freedom of speech, or of
 the press; or the right of the people peaceably to assemble, and to petition the
 government for a redress of grievances.</P>
<H1>ARTICLE II</H1>
<P>A well regulated militia, being necessary to the security of a free state,
 the right of the people to keep and bear arms, shall not be infringed.</P>
</BODY>
</HTML>

           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo HTML
» HTML CLass Style