當前位置:首頁 » 編程軟體 » 腳本製作計算器

腳本製作計算器

發布時間: 2025-07-19 17:18:30

⑴ 如何製作flash計算器

使用if語句來解決吧if語句-計算器
(a1/a2為輸入文本,a3為動態文本)
//在按鈕上添加此腳本,直接運算結果
on (release) {
_root.a3 = Number(_root.a1)+Number(_root.a2);
}

(另一種計算器的做法)
//加上所寫腳本,其它運算方式相似
on(release){
k=1;
}
//計算按鈕上所需腳本
on(release){
_root.COLOR: lime; FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">您的輸入有誤!";
if(k==1){
_root.c=Number(_root.a)+Number(_root.b);
}
if(k==2){
_root.c=Number(_root.a)-Number(_root.b);
}
if(k==3){
_root.c=Number(_root.a)*Number(_root.b);
}
if(k==4){
_root.c=Number(_root.a)/Number(_root.b);
}
}
//a、b為兩個輸入文本,c為顯示結果的動態文本

⑵ 用python操作Windows的計算器。

pyhook可以抓到鍵。

不過這里只需要消息就可以了,win32api中的windows的message

使用vc中的消息 工具,抓鍵盤消息。然後再把這個消息包裝一下用pywin32中的API發送過去。

我以前用pyhook加pywin32, 控制過一個游戲,做外掛。

也用pywin32的com介面控制過excel

⑶ 利用javaScript腳本語言編寫一個簡單的「網頁計算器」

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無標題文檔</title>
<script language="javascript">
function jsq(fh)
{
var num1,num2;
num1=parseFloat(document.form1.text1.value);
num2=parseFloat(document.form1.text2.value);
if(fh=="+")
document.form1.text3.value=num1+num2;
if(fh=="-")
document.form1.text3.value=num1-num2;
if(fh=="*")
document.form1.text3.value=num1*num2;
if(fh=="/")
if(num2!=0)
{
document.form1.text3.value=num1/num2;
}
else
{
alert ("除數不能為零!")
}
}
</script>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
<label>
<input name="text1" type="text" id="text1" />
</label>
<p>
<label>
<input name="text2" type="text" id="text2" />
</label>
</p>
<p>
<label>
<input name="Button1" type="Button" id="Button1" value="+" onClick="jsq('+')">
<input name="Button2" type="Button" id="Button2" value="-" onClick="jsq('-')"/>
<input name="Button3" type="Button" id="Button3" value="*" onClick="jsq('*')"/>
<input name="Button4" type="Button" id="Button4" value="/" onClick="jsq('/')"/>
</label>
</p>
<p>
<label>
<input name="text3" type="text" id="text3" />
</label>
</p>
</form>
</body>
</html>

熱點內容
天貓精靈設置密碼是多少 發布:2025-07-19 22:36:19 瀏覽:621
phppng透明 發布:2025-07-19 22:34:17 瀏覽:389
王者榮耀怎麼配置好玩 發布:2025-07-19 22:02:45 瀏覽:755
合肥市編程 發布:2025-07-19 21:56:40 瀏覽:652
方舟手游火影伺服器怎麼進 發布:2025-07-19 21:44:06 瀏覽:540
學校安防存儲系統 發布:2025-07-19 21:20:49 瀏覽:283
linux紅帽下載 發布:2025-07-19 21:16:00 瀏覽:541
人員怎麼配置 發布:2025-07-19 21:10:10 瀏覽:208
明日之後如何掃碼登伺服器 發布:2025-07-19 20:36:26 瀏覽:243
ftp搜索引擎工作原理 發布:2025-07-19 20:31:25 瀏覽:373