当前位置:首页 » 编程软件 » 脚本制作计算器

脚本制作计算器

发布时间: 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 21:44:06 浏览:535
学校安防存储系统 发布:2025-07-19 21:20:49 浏览:281
linux红帽下载 发布:2025-07-19 21:16:00 浏览:539
人员怎么配置 发布:2025-07-19 21:10:10 浏览:206
明日之后如何扫码登服务器 发布:2025-07-19 20:36:26 浏览:242
ftp搜索引擎工作原理 发布:2025-07-19 20:31:25 浏览:372
景物视频脚本 发布:2025-07-19 20:30:33 浏览:181
hadoop查看文件夹 发布:2025-07-19 20:19:12 浏览:22
安卓手机的旁白在哪里 发布:2025-07-19 20:09:40 浏览:741
身份证注册借书卡的密码是什么 发布:2025-07-19 19:44:39 浏览:77