| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1585 人关注过本帖
标题:是高手的进啊!!!!
只看楼主 加入收藏
fjfj1212
Rank: 1
等 级:新手上路
帖 子:113
专家分:0
注 册:2005-9-16
收藏
 问题点数:0 回复次数:13 
是高手的进啊!!!!

谁能帮我改一下啊!!!!!! <SCRIPT language=JavaScript> var FKeyPad = document.Keypad; var Accum = 0; var FlagNewNum = false; var PendingOp = ""; function NumPressed (Num) { if (FlagNewNum) { FKeyPad.ReadOut.value = Num; FlagNewNum = false; } else { if (FKeyPad.ReadOut.value == "0") FKeyPad.ReadOut.value = Num; else FKeyPad.ReadOut.value += Num; } } function Operation (Op) { var Readout = FKeyPad.ReadOut.value; if (FlagNewNum && PendingOp != "="); else { FlagNewNum = true; if ( '+' == PendingOp ) Accum += parseFloat(Readout); else if ( '-' == PendingOp ) Accum -= parseFloat(Readout); else if ( '/' == PendingOp ) Accum /= parseFloat(Readout); else if ( '*' == PendingOp ) Accum *= parseFloat(Readout); else Accum = parseFloat(Readout); FKeyPad.ReadOut.value = Accum; PendingOp = Op; } } function ClearEntry () { FKeyPad.ReadOut.value = "0"; FlagNewNum = true; } function Clear () { Accum = 0; PendingOp = ""; ClearEntry(); } function Neg () { FKeyPad.ReadOut.value = parseFloat(FKeyPad.ReadOut.value) * -1; } } </SCRIPT>

<form name="keypad" method="post" action=""> <table width="33%" height="219" border="1"> <tr> <td height="40" colspan="5"> <div align="right"> <input name="ReadOut" type="text" id="ReadOut"> </div></td> </tr> <tr> <td width="17%" height="42"> <div align="center"> <input name="btnSeven" type="button" id="btnSeven" value=" 7 " onclick="NumPressed('7')"> </div></td> <td width="21%"> <div align="center"> <input name="btnEight" type="button" id="btnEight" value=" 8 " onclick="NumPressed('8')"> </div></td> <td width="20%"><div align="center"> <input name="btnNine" type="button" id="a9" value=" 9 " onclick="NumPressed('9')"> </div></td> <td width="20%"><div align="center"> <input name="btnDivide" type="button" id="btnDivide" value=" / " onclick="Operation('/')"> </div></td> <td width="22%"><div align="center"> <input type="button" name="Submit5" value="sqrt"> </div></td> </tr> <tr> <td height="43"> <div align="center"> <input name="btnFour" type="button" id="btnFour" value=" 4 " onclick="NumPressed('4')"> </div></td> <td><div align="center"> <input name="btnFive" type="button" id="btnFive" value=" 5 " onclick="NumPressed('5')"> </div></td> <td><div align="center"> <input name="btnSix" type="button" id="btnSix" value=" 6 " onclick="NumPressed('6')"> </div></td> <td><div align="center"> <input name="btnMultiply" type="button" id="btnMultiply" value=" * " onclick="Operation('*')"> </div></td> <td><div align="center"> <input type="button" name="Submit10" value=" % "> </div></td> </tr> <tr> <td height="39"> <div align="center"> <input name="btnOne" type="button" id="btnOne" value=" 1 " onclick="NumPressed('1')"> </div></td> <td><div align="center"> <input name="btnTwo" type="button" id="btnTwo" value=" 2 " onclick="NumPressed('2')"> </div></td> <td><div align="center"> <input name="btnThree" type="button" id="btnThree" value=" 3 " onclick="NumPressed('3')"> </div></td> <td><div align="center"> <input name="btnMinus" type="button" id="btnMinus" value=" - " onclick="Operation('-')"> </div></td> <td><div align="center"> <input type="button" name="Submit15" value="1/x"> </div></td> </tr> <tr> <td height="41"> <input name="btnZero" type="button" id="btnZero" value=" 0 " onclick="NumPressed('0')"></td> <td><div align="center"> <input type="button" name="Submit17" value="+/-"> </div></td> <td><div align="center"> <input type="button" name="Submit18" value=" . "> </div></td> <td><div align="center"> <input name="btnPlus" type="button" id="btnPlus" value=" + " onclick="Operation('+')"> </div></td> <td><div align="center"> <input name="btnEquals" type="button" id="btnEquals" value=" = " onclick="Operation('=')"> </div></td> </tr> </table> </form>

搜索更多相关主题的帖子: var FKeyPad value Num ReadOut 
2005-09-16 09:32
fjfj1212
Rank: 1
等 级:新手上路
帖 子:113
专家分:0
注 册:2005-9-16
收藏
得分:0 
我急用啊!!!!!

我就是我!!! 永不退缩!!!
2005-09-16 09:38
fjfj1212
Rank: 1
等 级:新手上路
帖 子:113
专家分:0
注 册:2005-9-16
收藏
得分:0 

我就是我!!! 永不退缩!!!
2005-09-16 09:39
fjfj1212
Rank: 1
等 级:新手上路
帖 子:113
专家分:0
注 册:2005-9-16
收藏
得分:0 
快啊!!!

我就是我!!! 永不退缩!!!
2005-09-16 16:23
fjfj1212
Rank: 1
等 级:新手上路
帖 子:113
专家分:0
注 册:2005-9-16
收藏
得分:0 
我真的急用啊!!!!!

我就是我!!! 永不退缩!!!
2005-09-16 16:23
fjfj1212
Rank: 1
等 级:新手上路
帖 子:113
专家分:0
注 册:2005-9-16
收藏
得分:0 
哐若干工荆蓝天

我就是我!!! 永不退缩!!!
2005-09-16 16:24
ming206
Rank: 2
来 自:重庆
等 级:等待验证会员
威 望:3
帖 子:545
专家分:7
注 册:2005-8-2
收藏
得分:0 
我一看标题" 是高手的进啊!!!!" 我是与不是高手我会打死我也不会回这样的话~~~~~~~~~~! 请楼主以后注意.别人看这样的问题是不会回你的!

外贸综合平台:E贸通
2005-09-17 12:48
hugeannex
Rank: 8Rank: 8
等 级:蝙蝠侠
威 望:6
帖 子:483
专家分:911
注 册:2005-3-20
收藏
得分:0 
我只会加减乘除。

世事如潮我如水,只叹江湖几人回。
2005-09-18 20:15
fjfj1212
Rank: 1
等 级:新手上路
帖 子:113
专家分:0
注 册:2005-9-16
收藏
得分:0 
多谢指教!!!

我就是我!!! 永不退缩!!!
2005-09-19 09:34
happy99
Rank: 1
等 级:新手上路
帖 子:41
专家分:0
注 册:2005-5-5
收藏
得分:0 
看看这个行不行

[URL=http://myhappy99.go1.icpcn.com/article/calculator/calculator.htm]在这里看效果[/URL]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Page-Enter" content="revealtrans(Duration=3,Transition=23)">
<title>计算器</title>
<script language="javascript1.2" type="text/javascript">
var inputString=""; //初始化显示窗口值为空
function updateString(value){ //同步显示运算值
inputString+=value;
document.Calculator.Input.value=inputString;
}
function other(){ //求相反数
inputString = eval(0-inputString);
document.Calculator.Input.value=inputString;
}
function invest(){ //求倒数
inputString = eval(1/inputString);
document.Calculator.Input.value=inputString;
}
function sqrter(){ //求平方根
inputString = Math.sqrt(inputString);
document.Calculator.Input.value=inputString;
}
</script>
<style>
a:link{ text-decoration:none}
a:visited{ text-decoration:none}
a:hover{ text-decoration:none}
a:active{ text-decoration:none}
</style>
</head>
<body >
<div align="center">
<form action="" method="post" name="Calculator" id="Calculator"><br>
<table width="356" border="4" cellpadding="2" cellspacing="1" bordercolorlight="#999999" bordercolordark="#333333" bgcolor="#CCCCCC">
<tr>
<td height="29" colspan="5"><div align="right">
<font size="2" color="#0000FF"><a href="http://myhappy99.icpcn.com" target="_blank">☆默鸣小站欢迎您☆</a></font>
<input name="Input" type="text" style="height:20 " size="26" maxlength="100" align="right">
</div></td>
</tr>
<tr>
<td>
<div align="center">
<input name="seven" type="button" id="seven" onClick="updateString('7')" value=" 7 ">
</div></td>
<td>
<div align="center">
<input name="eight" type="button" id="eight" onClick="updateString('8')" value=" 8 ">
</div></td><td><div align="center">
<input name="nine" type="button" id="nine" onClick="updateString('9')" value=" 9 ">
</div></td>
<td><div align="center">
<input type="button" name="plus" value=" + " onClick="updateString('+')">
</div></td>
<td><div align="center">
<input name="sqrt" type="button" id="sqrt" value=" sqrt " onClick="sqrter();">
</div></td>
</tr>
<tr>
<td><div align="center">
<input name="four" type="button" id="four" onClick="updateString('4')" value=" 4 ">
</div></td>
<td><div align="center">
<input name="five" type="button" id="five" onClick="updateString('5')" value=" 5 ">
</div></td>
<td><div align="center">
<input name="six" type="button" id="six" onClick="updateString('6')" value=" 6 ">
</div></td>
<td><div align="center">
<input type="button" name="minus" value=" - " onClick="updateString('-')">
</div></td>
<td><div align="center">
<input name="invest" type="button" id="invest" onClick="invest();" value=" 1/x ">
</div></td>
</tr>
<tr>
<td><div align="center">
<input name="one" type="button" id="one" onClick="updateString('1')" value=" 1 ">
</div></td>
<td><div align="center">
<input name="two" type="button" id="two" onClick="updateString('2')" value=" 2 ">
</div></td>
<td><div align="center">
<input name="three" type="button" id="three" onClick="updateString('3')" value=" 3 ">
</div></td>
<td><div align="center">
<input type="button" name="times" value=" * " onClick="updateString('*')">
</div></td>
<td><div align="center">
<input name="clear" type="button" id="clear" onClick="Input.value='';inputString=''" value="clear">
</div></td>
</tr>
<tr>
<td><div align="center">
<input name="zero" type="button" id="zero" onClick="updateString('0')" value=" 0 ">
</div></td>
<td><div align="center">
<input name="plu/min" type="button" id="plu/min" onClick="other();" value=" +/- ">
</div></td>
<td><div align="center">
<input name="dot" type="button" id="dot" onClick="updateString('.')" value=" . ">
</div></td>
<td><div align="center">
<input type="button" name="div" value=" / " onClick="updateString('/')">
</div></td>
<td><div align="center">
<input name="equal" type="button" id="equal" onClick="document.Calculator.Input.value=eval(inputString);" value=" = ">
</div></td>
</tr>
</table>
</form>
</div>
</body>
</html>
[URL=http://myhappy99.go1.icpcn.com/article/calculator/calculator.htm]在这里看效果[/URL]

[此贴子已经被作者于2006-4-11 18:25:39编辑过]


以欢迎光临我的小站 http://myhappy99.
2005-09-19 16:30
快速回复:是高手的进啊!!!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.049201 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved