<input onkeydown="mm(this)" max=100 id=input1>
<SCRIPT LANGUAGE="JavaScript">
function mm(e)
{
if(e.id) setTimeout("setBGColor('"+ e.id +"')");
}
function setBGColor(id)
{
var e = document.getElementById(id);
if(e && e.max!="")
{
if(parseFloat(e.value) > e.max) e.style.backgroundColor = "#FF0000";
else e.style.backgroundColor = "#FFFFFF";
}
}
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
function mm(e)
{
if(e.id) setTimeout("setBGColor('"+ e.id +"')");
}
function setBGColor(id)
{
var e = document.getElementById(id);
if(e && e.max!="")
{
if(parseFloat(e.value) > e.max) e.style.backgroundColor = "#FF0000";
else e.style.backgroundColor = "#FFFFFF";
}
}
</SCRIPT>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
<style>
.maxclass{background-color:red}
</style>
<script>
function aa(text)
{
if (parseInt(text.value)>100)
{
text.parentNode.className="maxclass";
}
}
</script>
</head><body>
<form method="POST" action="--WEBBOT-SELF--">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1" height="386">
<tr>
<td width="33%" height="106">
<input type="text" name="T1" size="20" onkeyup="aa(this)"></p>
</td>
<td width="33%" height="106"><input type="text" name="T2" size="20" onkeyup="aa(this)"></td>
<td width="34%" height="106"><input type="text" name="T3" size="20" onkeyup="aa(this)"></td>
</tr>
<tr>
<td width="33%" height="149"><input type="text" name="T4" size="20" onkeyup="aa(this)"></td>
<td width="33%" height="149"><input type="text" name="T5" size="20" onkeyup="aa(this)"></td>
<td width="34%" height="149"><input type="text" name="T6" size="20" onkeyup="aa(this)"></td>
</tr>
<tr>
<td width="33%" height="129"><input type="text" name="T7" size="20" onkeyup="aa(this)"></td>
<td width="33%" height="129"><input type="text" name="T8" size="20" onkeyup="aa(this)"></td>
<td width="34%" height="129"><input type="text" name="T9" size="20" onkeyup="aa(this)"></td>
</tr>
</table>
</form>
</body></html>
<tr>
<td><input max=100 onkeyup="meizz(this)">max=100</td>
<td><input max=200 onkeyup="meizz(this)">max=200</td>
</tr>
<tr>
<td><input max=300 onkeyup="meizz(this)">max=300</td>
<td><input max=400 onkeyup="meizz(this)">max=400</td>
</tr>
<tr>
<td><input max=500 onkeyup="meizz(this)">max=500</td>
<td><input max=600 onkeyup="meizz(this)">max=600</td>
</tr>
</table><SCRIPT LANGUAGE="JavaScript">
function searchObjByTagName(obj, tag)
{
while(obj!=null && typeof(obj.tagName) != "undefind")
{
if(obj.tagName == tag.toUpperCase()) return(obj);
obj = obj.parentElement;
}
return null;
}
function meizz(e)
{
var td = searchObjByTagName(e, "TD");
if(e.max && parseFloat(e.value)>e.max)
{
e.style.backgroundColor = "yellow";
if(td) td.bgColor = "red"; //颜色你自己定
}
else //小于这个数时恢复到平常状态
{
e.style.removeAttribute("backgroundColor");
if(td) td.removeAttribute("bgColor");
}
}
</SCRIPT>