我有imacros的代码 我想收到结果。
TAG POS=1 TYPE=INPUT:HIDDEN ATTR=TYPE:text&&NAME:firstNumber&&VALUE:8
TAG POS=1 TYPE=INPUT:HIDDEN ATTR=TYPE:text&&NAME:secondNumber&&VALUE:9
SET !EXTRACT_TEST_POPUP NO
SET !EXTRACT NULL
TAG POS=1 TYPE=INPUT:HIDDEN ATTR=TYPE:text&&NAME:firstNumber&&VALUE:8 EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
SET !EXTRACT_TEST_POPUP NO
SET !EXTRACT NULL
TAG POS=1 TYPE=INPUT:HIDDEN ATTR=TYPE:text&&NAME:secondNumber&&VALUE:9 EXTRACT=TXT
SET !VAR2 {{!EXTRACT}}
SET !VAR3 EVAL("var a=\"{{!VAR1}}\"; var b=\"{{!VAR2}}\"; var z = (((a + b))); z")
PROMPT {{!VAR3}}
我已经尝试过这段代码,甚至是结果 click to see the result of imcros
任何想法如何解决。
答案 0 :(得分:0)
您需要的只是在加号之前将变量解析为int。
var a = parseInt( "{{!VAR1}}" );
var b = parseInt( "{{!VAR2}}" );
var z = a + b;
z;
因此,您只需要输入源代码:
TAG POS=1 TYPE=INPUT:HIDDEN ATTR=TYPE:text&&NAME:firstNumber&&VALUE:8
TAG POS=1 TYPE=INPUT:HIDDEN ATTR=TYPE:text&&NAME:secondNumber&&VALUE:9
SET !EXTRACT_TEST_POPUP NO
SET !EXTRACT NULL
TAG POS=1 TYPE=INPUT:HIDDEN ATTR=TYPE:text&&NAME:firstNumber&&VALUE:8 EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
SET !EXTRACT_TEST_POPUP NO
SET !EXTRACT NULL
TAG POS=1 TYPE=INPUT:HIDDEN ATTR=TYPE:text&&NAME:secondNumber&&VALUE:9 EXTRACT=TXT
SET !VAR2 {{!EXTRACT}}
SET !VAR3 EVAL("var a = parseInt( "{{!VAR1}}" );var b = parseInt( "{{!VAR2}}" );var z = a + b;z")
PROMPT {{!VAR3}}