js实现自动计算
<HTML>
<HEAD>
<title>文本框内容的自动复制</title>
<SCRIPT LANGUAGE="JavaScript"><!-- hide from old browsers
function enfocus()
{
var t1 = document.forms[0].Data.value;
var t2 = document.forms[0].Data2.value;
var t3 = document.forms[0].Copy.value ;
if(t1!="" && t2!=""){
document.getElementById("copy").value = parseInt(t1) * parseInt(t2) ;
}
else {document.getElementById("copy").value = "";}
}
<!-- done hiding -->
</SCRIPT>
</HEAD>
<BODY onLoad="">
<CENTER><FORM>
value1: <INPUT TYPE="TEXT" SIZE=40 NAME="Data" onkeyup="enfocus()"><br>
value2: <INPUT TYPE="TEXT" SIZE=40 NAME="Data2" onkeyup="enfocus()"><br>
相乘: <INPUT TYPE="TEXT" SIZE=40 NAME="Copy" id="copy"><br>
</FORM></CENTER>
</body>
</html>