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

脚本制作计算器

发布时间: 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>

热点内容
java返回this 发布:2025-10-20 08:28:16 浏览:588
制作脚本网站 发布:2025-10-20 08:17:34 浏览:883
python中的init方法 发布:2025-10-20 08:17:33 浏览:576
图案密码什么意思 发布:2025-10-20 08:16:56 浏览:762
怎么清理微信视频缓存 发布:2025-10-20 08:12:37 浏览:679
c语言编译器怎么看执行过程 发布:2025-10-20 08:00:32 浏览:1009
邮箱如何填写发信服务器 发布:2025-10-20 07:45:27 浏览:252
shell脚本入门案例 发布:2025-10-20 07:44:45 浏览:110
怎么上传照片浏览上传 发布:2025-10-20 07:44:03 浏览:801
python股票数据获取 发布:2025-10-20 07:39:44 浏览:707