主题:请各位哥哥帮忙看看 谢谢了
小弟是JAVA的处学者,老师出题让做一个计算器,我写了个HTML的程序,但是不会写 JS 老师要求要用 eval 问写 下面是我写的 HTML 文件 是不是写的太罗嗦了
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Script-Type"content="text/javascript"/>
</head>
<body>
<script type="text/javascript" src="java6.js"></script>
<p>an electronic calculator</p>
<form id="form1"name="form1">
<p>a number
<input type="text"name"tex1"value=""size=10/>
<input type="button"name"but"value="+"onClick="fn1()"/>
a number
<input type="text"name"tex1"value=""size=10/>
<input type="button"name"but"value="="onClick="fn5()"/>
effect
<input type="text"name"tex2"value=""size=10/>
addition</p>
</from>
<form id="form2"name="form2">
<p>a number
<input type="text"name"tex1"value=""size=10/>
<input type="button"name"but"value="-"onClick="fn2()"/>
a number
<input type="text"name"tex1"value=""size=10/>
<input type="button"name"but"value="="onClick="fn6()"/>
effect
<input type="text"name"tex2"value=""size=10/>
subtraction</p>
</from>
<form id="form3"name="form3">
<p>a number
<input type="text"name"tex1"value=""size=10/>
<input type="button"name"but"value="*"onClick="fn3()"/>
a number
<input type="text"name"tex1"value=""size=10/>
<input type="button"name"but"value="="onClick="fn7()"/>
effect
<input type="text"name"tex2"value=""size=10/>
multiplication</p>
</from>
<form id="form4"name="form4">
<p>a number
<input type="text"name"tex1"value=""size=10/>
<input type="button"name"but"value="/"onClick="fn4()"/>
a number
<input type="text"name"tex1"value=""size=10/>
<input type="button"name"but"value="="onClick="fn8()"/>
effect
<input type="text"name"tex2"value=""size=10/>
division</p>
</form>
</body>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Script-Type"content="text/javascript"/>
</head>
<body>
<script type="text/javascript" src="java6.js"></script>
<p>an electronic calculator</p>
<form id="form1"name="form1">
<p>a number
<input type="text"name"tex1"value=""size=10/>
<input type="button"name"but"value="+"onClick="fn1()"/>
a number
<input type="text"name"tex1"value=""size=10/>
<input type="button"name"but"value="="onClick="fn5()"/>
effect
<input type="text"name"tex2"value=""size=10/>
addition</p>
</from>
<form id="form2"name="form2">
<p>a number
<input type="text"name"tex1"value=""size=10/>
<input type="button"name"but"value="-"onClick="fn2()"/>
a number
<input type="text"name"tex1"value=""size=10/>
<input type="button"name"but"value="="onClick="fn6()"/>
effect
<input type="text"name"tex2"value=""size=10/>
subtraction</p>
</from>
<form id="form3"name="form3">
<p>a number
<input type="text"name"tex1"value=""size=10/>
<input type="button"name"but"value="*"onClick="fn3()"/>
a number
<input type="text"name"tex1"value=""size=10/>
<input type="button"name"but"value="="onClick="fn7()"/>
effect
<input type="text"name"tex2"value=""size=10/>
multiplication</p>
</from>
<form id="form4"name="form4">
<p>a number
<input type="text"name"tex1"value=""size=10/>
<input type="button"name"but"value="/"onClick="fn4()"/>
a number
<input type="text"name"tex1"value=""size=10/>
<input type="button"name"but"value="="onClick="fn8()"/>
effect
<input type="text"name"tex2"value=""size=10/>
division</p>
</form>
</body>