className HTML- class. :
document. body. className = myclass ;
, :
document. body. className += myclass ;
, , , className.
, className :
document. body. className = ;
CSS-
style CSS-, :
element. style. color = red
, , :
background-color => backgroundColor
border-left-width => borderLeftWidth
CSS- .
style.cssText, css- , , css :
element.style.cssText="color: red!important; background-color: yellow;
style.cssText style , css-, cssText.
:
<html>
<head>
<styletype= "text/css" >
.mytable {text-align: center; font-family: Verdana; color: #D02090; background: #00FFFF; font-weight: bold; font-size: 120%}
</style>
<script>
function setStyle ( form ){
table1 = document.getElementById ( 'mytable' );
switch ( form.set_style.value ){
case "1" :{
table1.style.cssText = ""; // css-
table1.className = "mytable"//
}
; break;
case "2" :{
table1.className = ""//
table1.style.cssText = ""; // css-
table1.style.cssText = "color: red; background-color: yellow;"// css-
table1.style.width = "60%"// css-
}
; break;
case "3" :{
table1.setAttribute ( "border", "0" ) // table
}
; break;
case "4" :{
table1.setAttribute ( "border", "1" ) // table
}
; break;
}
}
</script>
</head>
<body>
:
<tableid= "mytable" border= "1" >
<tr>
<th> 1 </th>
<th> 2 </th>
<th> 3 </th>
|
|
</tr>
<tr>
<td> 1 </td>
<td> 2 </td>
<td> 3 </td>
</tr>
<table>
<br>
:
<form>
<selectname= "set_style" size= "1" onChange= "setStyle(this.form)" >
<optionvalue= "0" >
<optionvalue= "1" >
<optionvalue= "2" >
<optionvalue= "3" >
<optionvalue= "4" >
</form>
</body>
</html>
. , . , :
. , , . , :
: , , . .
. css- <link>, :
. . . 4.3.8.
http://www.web-lesson.ru/site-creation/html/38-osnovy-css-i-html-blochnaya-verstka.html
http://dunaevv1.narod.ru/inclhtml.htm
http://dunaevv1.narod.ru/db0.htm
http://forum.codeby.net/topic5887.html