主要就是有颜色的句子不明白,请帮忙看下,谢谢了
<head>
<title>A simple calculator</title>
<script type = "text/javascript">
<!-- function doit() {
form.input.value = eval(form.input.value)
}
</script>
</head> <body>
<form name = "form" action = "">
<table border = "1" width = "450" cellspacing = "5"
summary = "This is a calculator used to calculate simple mathematics operations"> <caption>Simple Calculator</caption> <thead></thead>
<tbody>
<tr>
<td colspan = "3" height = "15">
<input name = "input" type = "text" size = "32"></td>
</tr> <tr>
<td width = "60" height = "15">
<input name = "one" type = "button" value = " 1 "
onClick = "form.input.value += '1'" /></td>
<td width = "60" height = "15">
<input name = "two" type = "button" value = " 2 "
onClick = "form.input.value += '2'" /></td>
<td width = "60" height = "15">
<input name = "three" type = "button" value = " 3 "
onClick = "form.input.value += '3'" /></td>
<td width = "1" height = "15"></td>
<td width = "60" height = "15">
<input name = "MultiplySign" type = "button" value = " * "
onClick = "form.input.value += '*'" /></td>
</tr>
<tr>
<td width = "60" height = "15">
<input name = "equal" type = "button" value = " = "
onClick = "doit()" /></td>
</tr>
</table>
</form>
</body>
<head>
<title>A simple calculator</title>
<script type = "text/javascript">
<!-- function doit() {
form.input.value = eval(form.input.value)
}
</script>
</head> <body>
<form name = "form" action = "">
<table border = "1" width = "450" cellspacing = "5"
summary = "This is a calculator used to calculate simple mathematics operations"> <caption>Simple Calculator</caption> <thead></thead>
<tbody>
<tr>
<td colspan = "3" height = "15">
<input name = "input" type = "text" size = "32"></td>
</tr> <tr>
<td width = "60" height = "15">
<input name = "one" type = "button" value = " 1 "
onClick = "form.input.value += '1'" /></td>
<td width = "60" height = "15">
<input name = "two" type = "button" value = " 2 "
onClick = "form.input.value += '2'" /></td>
<td width = "60" height = "15">
<input name = "three" type = "button" value = " 3 "
onClick = "form.input.value += '3'" /></td>
<td width = "1" height = "15"></td>
<td width = "60" height = "15">
<input name = "MultiplySign" type = "button" value = " * "
onClick = "form.input.value += '*'" /></td>
</tr>
<tr>
<td width = "60" height = "15">
<input name = "equal" type = "button" value = " = "
onClick = "doit()" /></td>
</tr>
</table>
</form>
</body>
解决方案 »
- 求ie6用js设置top为expression的方法
- Ext/js中头疼问题
- 在VS2008 中运行JS代码时,CPU使用率竟到100%.何解?
- 返回在数组中的位置
- DIV 容器中相对定位
- [高分求解] Javascript或jQuery 如何判断鼠标悬停和文本框获得焦点的状态?
- 网页里实现上下分页显示,如何点击上面的页面的一个submit,传递参数到下面页面,下面页面根据参数刷新页面
- 哪里有支持无限分类的树型目录????
- 请问下面的3个正则有什么区别呢
- js原型中一个奇怪的问题
- jQuery官网上的jQuery Starterkit 下载内容很怪?
- 今天看了一下google friend connect
相当于在form.input.value = form.input.value + '1'
意思是在原来的基础上加1
。
这是一个计算器代码的一部分,我给截出来了,这样还少点
我不明白的是这个计算器的工作原理,也就是怎么能把数给算出来的呢
<input name = "one" type = "button" value = " 1 "
onClick = "form.input.value += '1'" /></td>
就想上边的代码,一这个按钮的VALUE不应该是 FORM.ONE.VALUE吗
onClick = "form.input.value += '1'" /></td>
这个onClick方法所改变的是
<input name = "input" type = "text" size = "32"></td>
这个文本框的值,而form.input.value += '1'意思是在每次按下改按钮时,
<input name = "input" type = "text" size = "32"></td>
改文本框显示的值自动追加1,如原来是1,那么按一下就变11,依次类推其他按钮的方法是一样的功能