2005/06/22 | 通过js改变text的颜色
类别(WEB相关) | 评论(0) | 阅读(379) | 发表于 10:26
<!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=gb2312" />
<title>无标题文档</title>
<script language="javascript" type="text/javascript">
function setColorChange(color)
{
document.getElementById("txtMax").style.background=color;
document.getElementById("txtMax").style.color="yellow";
}
</script>
</head>
<input type="text" name="txtId" id="txtMax" maxlength="6" value="2513" />
<input type="text" name="txtName" maxlength="6" value="Ken" />
<a href="#" onclick="javascript:setColorChange('blue')">colorChangeBlue</a>
<a href="#" onclick="javascript:setColorChange('red')">colorChangeRed</a>
<body>
</body>
</html>
0

评论Comments