<INPUT TYPE="text" NAME="aa" onblur="if(!isValid()){alert('error');this.focus();}">
<script >
function isValid(){
/*
chece the value
*/
return false;
}
</script>
<script >
function isValid(){
/*
chece the value
*/
return false;
}
</script>
调试欢乐多
<input name=txt1
onkeypress="var k=event.keyCode; return k>=48&&k<=57||k==46"
onpaste="return !clipboardData.getData('text').match(/\D/)"
onblur="cc(this)"
onpropertychange="addValue()"
ondragenter="return false"
style="ime-mode:Disabled"
><br><input name=txt2
onkeypress="var k=event.keyCode; return k>=48&&k<=57||k==46"
onpaste="return !clipboardData.getData('text').match(/\D/)"
onblur="cc(this)"
onpropertychange="addValue()"
ondragenter="return false"
style="ime-mode:Disabled"
><br><input name=txt3
onkeypress="var k=event.keyCode; return k>=48&&k<=57||k==46"
onpaste="return !clipboardData.getData('text').match(/\D/)"
onblur="cc(this)"
onpropertychange="addValue()"
ondragenter="return false"
style="ime-mode:Disabled"
><br><input name=allValue readonly></form><script language="JavaScript"><!--
function cc(e)
{
if(e.value!='')
{
if(parseFloat(e.value)>100 || parseFloat(e.value)<0)
{
alert('你输入的数值不在0-100之间');
e.focus();
}
}
}
function addValue()
{
var s1 = document.form1.txt1.value;
var s2 = document.form1.txt2.value;
var s3 = document.form1.txt3.value;
if (s1 == "") s1 = 0;
if (s2 == "") s2 = 0;
if (s3 == "") s3 = 0;
document.form1.allValue.value = parseFloat(s1) + parseFloat(s2) + parseFloat(s3);
}
//--></script>
<input name="text1" type="text" value="aaa" onFocus="this.blur()"/>