web19.html

来自「javascript 的一些简单例子 主要面对初学者」· HTML 代码 · 共 56 行

HTML
56
字号
<html>
<head>
<title>the web page is very good</title>
<script language="JavaScript">
function a()
{
var m=document.form1.text1.value;
var n=document.form1.text2.value;
var z;
z=m*1+n*1;
document.form1.text3.value=z;
}

function b()
{
var m=document.form1.text1.value;
var n=document.form1.text2.value;
var z;
z=m-n;
document.form1.text3.value=z;
}

function c()
{
var m=document.form1.text1.value;
var n=document.form1.text2.value;
var z;
z=m*n;
document.form1.text3.value=z;
}

function d()
{
var m=document.form1.text1.value;
var n=document.form1.text2.value;
var z;
z=m/n;
document.form1.text3.value=z;
}
</script>
</head>

</body>
<form name="form1">
please enter the first number:<br/>
<input type="text" name="text1"><br/>
please enter the second number:
<input type="text" name="text2"><br/>
<input type="text" name="text3">
<input type="button" onclick="a()" value="add">
<input type="button" onclick="b()" value="min">
<input type="button" onclick="c()" value="mul">
<input type="button" onclick="d()" value="div">
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?