![]() |
#2
weifeng3782016-12-31 23:01
|

求,和的代码/???
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>I love Chen.....</title>
<script>
window.onload=function(){
var oTxt1 = document.getElementById("txt1");
var oTxt2 = document.getElementById("btn2");
var oBtn = document.getElementById("btn1");
oBtn.onclick = function(){
alert(parseInt(oTxt1.value) + parseInt(oTxt2.value));
};
};
</script>
</head>
<body>
<input type="text" id="txt1" />
<input type="text" id="txt2" />
<input type="button" id="btn1" value="求和" />
</body>
</html>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>I love Chen.....</title>
<script>
window.onload=function(){
var oTxt1 = document.getElementById("txt1");
var oTxt2 = document.getElementById("btn2");
var oBtn = document.getElementById("btn1");
oBtn.onclick = function(){
alert(parseInt(oTxt1.value) + parseInt(oTxt2.value));
};
};
</script>
</head>
<body>
<input type="text" id="txt1" />
<input type="text" id="txt2" />
<input type="button" id="btn1" value="求和" />
</body>
</html>