用javascript实现吧。效果比asp好;最下面是asp的,你也可以看一下。
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form name="form1" method="post" onSubmit="return false" action="">
<input name="nums" type="text" id="nums" onKeyUp="run()">
</form></td>
</tr>
<tr>
<td id="answer"> </td>
</tr>
</table>
<script language="javascript">
function run(){
if(isNaN(document.form1.nums.value)){
answer.innerHTML="请输入数字!";
}else{
answer.innerHTML=document.form1.nums.value*0.1;
}
}
</script>
--------以下为asp部分----------------
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form name="form1" method="post" action="">
<input name="nums" type="text" id="nums">
<input name="Submit" type="submit" value="计 算">
</form></td>
</tr>
<tr>
<td id="answer"><%if isnumeric(request.Form("nums")) then response.Write(clng(request.Form("nums"))*0.1) else response.Write("请输入数字") end if%></td>
</tr>
</table>