className用法
马克- to-win:马克 java社区:防盗版实名手机尾号: 73203。
例 4.1(keyIEFF.html)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>
</title>
<script language="JavaScript" type="text/javascript">
function calc(thistextar, Span) {
var len = thistextar.value.length;
Span.innerHTML = len + ' 字';
Span.className = 'toredC';
}
</script>
<style type="text/css">
<!--
.toredC {
color: #FF0000;
}
-->
</style>
</head>
<body><textarea cols="50" rows="3" onKeyUp="calc(this,document.getElementById('num'))"
></textarea>
(<SPAN id=num>字数</SPAN>)
</body>
</html>
后续:
1)改变背景图: document.getElementById("coverImage").style.backgroundImage="url(cover_1.png)";