JS 调用

<html>
<head>
<title>计算器</title>
<script lauguage="javascript">
function js(x,y,z){
var num1=parseFloat(document.getElementById(x).value,10);
var num2=parseFloat(document.getElementById(y).value,10);
document.getElementById(z).innerHTML=num1+num2;
}
</script>
</head>
<body>
<p>
  <input type="text" id="num1" OnKeyUp="js('num1','num2','r1')"/>+
  <input type="text" id="num2" OnKeyUp="js('num1','num2','r1')"/>=<a id="r1"></a></p>
</body>
</html>

posted @ 2013-01-30 22:39  sirili  阅读(198)  评论(0编辑  收藏  举报