我们使用"class"类属性来改变文档的样式。
这个例子的代码是这样的:
<html>
<head>
<title>change style</title>
<style>
<!--
.bigchange{color:blue;font-weight:bolder;font-size:225%;
letter-spacing:4px;background:yellow;}
//
.start{color:yellow;background:navy;}
//
-->
</style>
</head>
<body>
<h1>动态改变样式</h1>
<p>请把鼠标移到蓝色背景的文字下面。</p>
<p>我们使用"class"类属性来改变文档的样式。
<span onmouseover="this.className='bigchange'"
onmouseout="this.classname='start'" class="start"
style="cursor:hand">
放大这段文本。 </span> </p> </body>
//
</html>
这个例子很简单,容易理解。