autojs控件计算命令代码大全,autojs运算符

本文目录一览:

求把电脑用的按键精灵代码转译为auto.js用的代码

主要是Goto 继续——Rem 继续 如何转化和 颜色判断中的“如果是则执行A,否则执行B”怎么写 其他的没问题了 下面是参考代码 Rem 继续 MoveTo 826, 296 Delay 1000 LeftClick 1 Delay 5000 IfColor 928,663,”232352″,2 Then MoveTo 928,663 Delay 3000 LeftClick 1 Else MoveTo 706, 577 LeftClick 1 MoveTo 801, 249 Delay 3000 LeftClick 1 MoveTo 728, 577 Delay 3000 LeftClick 1 MoveTo 614, 447 Delay 3000 LeftClick 1 MoveTo 739, 291 Delay 3000 LeftClick 1 MoveTo 952, 652 Delay 3000 LeftClick 1 End If Delay 120000 For 20 Delay 5000 IfColor 1140,680,”FFFFFF”,0 Then MoveTo 1145, 678 LeftClick 1 Delay 15000 Goto 继续 Else MoveTo 790, 450 Delay 3000 LeftClick 1 MoveTo 728, 580 Delay 3000 LeftClick 1 End If Next

Autojs手机版教程

AutoJs最新版本apk是一款颇为实用的安卓手机免root脚本制作工具,其中的代码都是入门级别的,有点程序基础的用户都能看懂,而对编程全然不知的用户只要修改应用中的坐标和次数也能够轻松完成脚本编辑,游戏录制、应用功能启动等一触即达。

一个不需要Root权限的类似按键精灵的自动操作软件,可以实现自动点击、滑动、输入文字、打开应用等。注意:这里的不需要Root权限指的是一般软件,游戏的自动点击等是需要Root权限的。

AutoJs最新版本apk特色:

1.简单易用的自动操作函数;

2.悬浮窗录制和运行;

3.丰富的文档、教程与示例;

4.更专业强大的选择器API,提供对屏幕上的控件的寻找、遍历、获取信息、操作等。类似于Google的UI测试框架UiAutomator,您也可以把他当做移动版UI测试框架使用;

6.采用JavaScript为脚本语言,支持简单的代码补全。您也可以把他当作简便的JavaScript IDE使用;

7.带有界面分析工具,类似Android Studio的LayoutInspector,可以分析界面层次和范围、获取界面上的控件信息;

8.支持使用Root权限以提供更强大的屏幕点击、滑动、录制功能和运行shell命令。

AutoJs最新版本apk使用说明:

有些按钮或者部件是图标而不是文字(例如发送朋友圈的照相机图标以及QQ下方的消息、练联系人、动态图标),这是不能通过click来点击,只能通过描述图标所在的区域来点击。

用js代码做一个简易计算器

function test(){

     var txt1 = document.getElementById(“txt1”),

         txt2 = document.getElementById(“txt2”),

         txt3 = document.getElementById(“txt3”),

         opt  = document.getElementById(“sel”);

     txt3.value =  eval(txt1.value + opt.value + txt2.value);//eval函数可计算某个字符串,并执行其中的的js代码

}

input type=”text” id=”txt1″ /

select id=”sel”

     option value=”+”+/option

     option value=”-“-/option

     option value=”*”*/option

     option value=”/”//option

/select

input type=”text” id=”txt2″ /

=

input type=”text” id=”txt3″ /

input type=”button” id=”btn” value=”计算” onclick=”test()”/

如何使用javascript编写一个计算器

首先,由于JS的存在数值的精度误差问题:

0.1+0.2   //0.30000000000000004

0.3-0.1   //0.19999999999999998

所以在编写计算器是应首先解决计算精度问题,以下四个代码段分别是js中精确的加减乘除运算函数

//浮点数加法运算

function floatAdd(arg1,arg2){

var r1,r2,m;

try{r1=arg1.toString().split(“.”)[1].length}catch(e){r1=0}

try{r2=arg2.toString().split(“.”)[1].length}catch(e){r2=0}

m=Math.pow(10,Math.max(r1,r2));

return (arg1*m+arg2*m)/m

}

//浮点数减法运算

function floatSub(arg1,arg2){

   var r1,r2,m,n;

   try{r1=arg1.toString().split(“.”)[1].length}catch(e){r1=0}

   try{r2=arg2.toString().split(“.”)[1].length}catch(e){r2=0}

   m=Math.pow(10,Math.max(r1,r2));

   //动态控制精度长度

   n=(r1=r2)?r1:r2;

   return ((arg1*m-arg2*m)/m).toFixed(n);

}

//浮点数乘法运算

function floatMul(arg1,arg2){

   var m=0,s1=arg1.toString(),s2=arg2.toString();

   try{m+=s1.split(“.”)[1].length}catch(e){}

   try{m+=s2.split(“.”)[1].length}catch(e){}

   return Number(s1.replace(“.”,””))*Number(s2.replace(“.”,””))/Math.pow(10,m)

}

//浮点数除法运算

function floatDiv(arg1,arg2) {

   var t1 = 0, t2 = 0, r1, r2;

   try {t1 = arg1.toString().split(“.”)[1].length} catch (e) {}

   try {t2 = arg2.toString().split(“.”)[1].length} catch (e) {}

   with (Math) {

       r1 = Number(arg1.toString().replace(“.”, “”));

       r2 = Number(arg2.toString().replace(“.”, “”));

       return (r1 / r2) * pow(10, t2 – t1);

   }

}

以下是详细的计算器代码: 

HTML5

!DOCTYPE html

html lang=”en”

head

meta charset=”UTF-8″

title简单计算器/title

link href=”main.css” rel=”stylesheet”

/head

body

div id=”calculator”

div id=”calculator_container”

h3计算器/h3

table id=”calculator_table”

tbody

tr

td colspan=”5″

input type=”text” id=”resultIpt” readonly=”readonly” value=”” size=”17″ maxlength=”17″ style=”width:294px;color: black”

/td

/tr

tr

tdinput type=”button” value=”←”       class=”btn_color1 btn_operation”/td

tdinput type=”button” value=”全清”     class=”btn_color1 btn_operation”/td

tdinput type=”button” value=”清屏”     class=”btn_color1″/td

tdinput type=”button” value=”﹢/﹣”    class=”btn_color2 btn_operation”/td

tdinput type=”button” value=”1/×”     class=”btn_color2 btn_operation”/td

/tr

tr

tdinput type=”button”  value=”7″     class=”btn_color3 btn_number”/td

tdinput type=”button”  value=”8″     class=”btn_color3 btn_number”/td

tdinput type=”button”  value=”9″     class=”btn_color3 btn_number”/td

tdinput type=”button”  value=”÷”    class=”btn_color4 btn_operation”/td

tdinput type=”button”  value=”%”    class=”btn_color2 btn_operation”/td

/tr

tr

tdinput type=”button”   value=”4″   class=”btn_color3 btn_number”/td

tdinput type=”button”   value=”5″   class=”btn_color3 btn_number”/td

tdinput type=”button”   value=”6″   class=”btn_color3 btn_number”/td

tdinput type=”button”   value=”×”  class=”btn_color4 btn_operation”/td

tdinput type=”button”   value=”√”  class=”btn_color2 btn_operation”/td

/tr

tr

tdinput type=”button”  value=”1″   class=”btn_color3 btn_number”/td

tdinput type=”button”  value=”2″   class=”btn_color3 btn_number”/td

tdinput type=”button”  value=”3″   class=”btn_color3 btn_number”/td

tdinput type=”button”  value=”-”  class=”btn_color4 btn_operation”/td

td rowspan=”2″

input type=”button”  value=”=”  class=”btn_color2″ style=”height: 82px” id=”simpleEqu”

/td

/tr

tr

td colspan=”2″

input type=”button”  value=”0″   class=”btn_color3 btn_number” style=”width:112px”

/td

tdinput type=”button”  value=”.”   class=”btn_color3 btn_number” /td

tdinput type=”button”  value=”+”  class=”btn_color4 btn_operation”/td

/tr

/tbody

/table

/div

/div

script type=”text/javascript” src=”calculator.js”/script

/body

/html

CSS3

* {

margin: 0;

padding: 0;

}

#calculator{

position: relative;

margin: 50px auto;

width: 350px;

height: 400px;

border: 1px solid gray;

-webkit-border-radius: 10px;

-moz-border-radius: 10px;

border-radius: 10px;

-webkit-box-shadow: 2px 2px 4px gray;

-moz-box-shadow: 2px 2px 4px gray;

box-shadow: 2px 2px 4px gray;

behavior:url(“ie-css3.htc”);  /*IE8-*/

}

#calculator_table{

position: relative;

margin: 10px auto;

border-collapse:separate;

border-spacing:10px 20px;

}

h3{

position: relative;

width: 60px;

height: 30px;

margin: 0 auto;

}

#calculator_table td{

width: 50px;

height: 30px;

border: 1px solid gray;

-webkit-border-radius: 2px;

-moz-border-radius: 2px;

border-radius: 2px;

behavior:url(“ie-css3.htc”);  /*IE8-*/

}

#calculator_table td input{

font-size: 16px;

border: none;

width: 50px;

height: 30px;

color: white;

}

input.btn_color1{

background-color: orange;

}

input.btn_color2{

background-color: #133645;

}

input.btn_color3{

background-color: #59807d;

}

input.btn_color4{

background-color: seagreen;

}

input:active{

-webkit-box-shadow: 3px 3px 3px gray;

-moz-box-shadow: 3px 3px 3px gray;

box-shadow: 3px 3px 3px gray;

behavior:url(“ie-css3.htc”);  /*IE8-*/

}

JS

window.onload=function() {

var resultIpt = document.getElementById(“resultIpt”); //获取输出文本框

var btns_number = document.getElementsByClassName(“btn_number”); //获取数字输入按钮

var btns_operation = document.getElementsByClassName(“btn_operation”); //获取操作按钮

var simpleEqu = document.getElementById(“simpleEqu”); //获取”=”按钮

var temp = “”;

var num1= 0,num2=0;

//获取第一个数

for(var i=0;ibtns_number.length;i++){

btns_number[i].onclick=function (){

temp += this.value;

resultIpt.value = temp;

};

}

//对获取到的数进行操作

for(var j=0;jbtns_operation.length;j++) {

btns_operation[j].onclick = function () {

num1=parseFloat(resultIpt.value);

oper = this.value;

if(oper==”1/×”){

num1 = Math.pow(num1,-1); //取倒数

resultIpt.value = num1.toString();

}else if(oper==”﹢/﹣”){    //取相反数

num1 = -num1;

resultIpt.value = num1.toString();

}else if(oper==”√”){      //取平方根

num1 =Math.sqrt(num1);

resultIpt.value = num1.toString();

}else if(oper==”←”){    //删除个位

resultIpt.value = resultIpt.value.substring(0, resultIpt.value.length – 1);

}else if(oper==”全清”){  //清除数字

resultIpt.value = “”;

}

else{          //oper==”+” “-” “×” “÷” “%”时,继续输入第二数字

temp = “”;

resultIpt.value = temp;

}

}

}

//输出结果

simpleEqu.onclick=function(){

num2=parseFloat(temp);  //取得第二个数字

calculate(num1, num2, oper);

resultIpt.value = result.toString();

}

};

//定义一个计算函数

function calculate(num1, num2, oper) {

switch (oper) {

case “+”:

result=floatAdd(num1, num2); //求和

break;

case “-”:

result=floatSub(num1, num2); //求差

break;

case “×”:

result=floatMul(num1, num2);  //求积

break;

case “÷”:

result=floatDiv(num1, num2);  //求商

break;

case “%”:

result=num1%num2;  //求余数

break;

}

}

//精确计算

//浮点数加法运算

function floatAdd(arg1,arg2){

var r1,r2,m;

try{r1=arg1.toString().split(“.”)[1].length}catch(e){r1=0}

try{r2=arg2.toString().split(“.”)[1].length}catch(e){r2=0}

m=Math.pow(10,Math.max(r1,r2));

return (arg1*m+arg2*m)/m

}

//浮点数减法运算

function floatSub(arg1,arg2){

var r1,r2,m,n;

try{r1=arg1.toString().split(“.”)[1].length}catch(e){r1=0}

try{r2=arg2.toString().split(“.”)[1].length}catch(e){r2=0}

m=Math.pow(10,Math.max(r1,r2));

//动态控制精度长度

n=(r1=r2)?r1:r2;

return ((arg1*m-arg2*m)/m).toFixed(n);

}

//浮点数乘法运算

function floatMul(arg1,arg2){

var m=0,s1=arg1.toString(),s2=arg2.toString();

try{m+=s1.split(“.”)[1].length}catch(e){}

try{m+=s2.split(“.”)[1].length}catch(e){}

return Number(s1.replace(“.”,””))*Number(s2.replace(“.”,””))/Math.pow(10,m)

}

//浮点数除法运算

function floatDiv(arg1,arg2) {

var t1 = 0, t2 = 0, r1, r2;

try {t1 = arg1.toString().split(“.”)[1].length} catch (e) {}

try {t2 = arg2.toString().split(“.”)[1].length} catch (e) {}

with (Math) {

r1 = Number(arg1.toString().replace(“.”, “”));

r2 = Number(arg2.toString().replace(“.”, “”));

return (r1 / r2) * pow(10, t2 – t1);

}

}

原创文章,作者:小蓝,如若转载,请注明出处:https://www.506064.com/n/284680.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
小蓝小蓝
上一篇 2024-12-22 15:41
下一篇 2024-12-22 15:41

相关推荐

  • Python周杰伦代码用法介绍

    本文将从多个方面对Python周杰伦代码进行详细的阐述。 一、代码介绍 from urllib.request import urlopen from bs4 import Bea…

    编程 2025-04-29
  • Python字符串宽度不限制怎么打代码

    本文将为大家详细介绍Python字符串宽度不限制时如何打代码的几个方面。 一、保持代码风格的统一 在Python字符串宽度不限制的情况下,我们可以写出很长很长的一行代码。但是,为了…

    编程 2025-04-29
  • Python基础代码用法介绍

    本文将从多个方面对Python基础代码进行解析和详细阐述,力求让读者深刻理解Python基础代码。通过本文的学习,相信大家对Python的学习和应用会更加轻松和高效。 一、变量和数…

    编程 2025-04-29
  • 仓库管理系统代码设计Python

    这篇文章将详细探讨如何设计一个基于Python的仓库管理系统。 一、基本需求 在着手设计之前,我们首先需要确定仓库管理系统的基本需求。 我们可以将需求分为以下几个方面: 1、库存管…

    编程 2025-04-29
  • Python满天星代码:让编程变得更加简单

    本文将从多个方面详细阐述Python满天星代码,为大家介绍它的优点以及如何在编程中使用。无论是刚刚接触编程还是资深程序员,都能从中获得一定的收获。 一、简介 Python满天星代码…

    编程 2025-04-29
  • 写代码新手教程

    本文将从语言选择、学习方法、编码规范以及常见问题解答等多个方面,为编程新手提供实用、简明的教程。 一、语言选择 作为编程新手,选择一门编程语言是很关键的一步。以下是几个有代表性的编…

    编程 2025-04-29
  • Python实现简易心形代码

    在这个文章中,我们将会介绍如何用Python语言编写一个非常简单的代码来生成一个心形图案。我们将会从安装Python开始介绍,逐步深入了解如何实现这一任务。 一、安装Python …

    编程 2025-04-29
  • 怎么写不影响Python运行的长段代码

    在Python编程的过程中,我们不可避免地需要编写一些长段代码,包括函数、类、复杂的控制语句等等。在编写这些代码时,我们需要考虑代码可读性、易用性以及对Python运行性能的影响。…

    编程 2025-04-29
  • Python海龟代码简单画图

    本文将介绍如何使用Python的海龟库进行简单画图,并提供相关示例代码。 一、基础用法 使用Python的海龟库,我们可以控制一个小海龟在窗口中移动,并利用它的“画笔”在窗口中绘制…

    编程 2025-04-29
  • Python爱心代码动态

    本文将从多个方面详细阐述Python爱心代码动态,包括实现基本原理、应用场景、代码示例等。 一、实现基本原理 Python爱心代码动态使用turtle模块实现。在绘制一个心形的基础…

    编程 2025-04-29

发表回复

登录后才能评论