imacros if else javascript simple

这一生的挚爱 提交于 2020-01-25 06:32:24

问题


I have set up a basic webpage

testim.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Members</title>

</head>

<body>Done</body>

</html>

----------

I have then set up the following imacros script - very basic however everytime i run it though the if condition is not true. If i do a iimDisplay of the iimGetExtract it returns Done, and still the if condition is not true.

var macro_var;
macro_var="CODE:VERSION BUILD=8530828 RECORDER=FX\n";
macro_var+="TAB T=1\n";
macro_var+="URL GOTO=http://www.example.com/testim.html\n";
macro_var+="TAG POS=1 TYPE=BODY ATTR=TXT:* EXTRACT=TXT\n";

iimPlay(macro_var);

if(iimGetExtract(0)=="Done"){
iimDisplay("success");
}

Thanks


回答1:


Try this.

var macro_var;
macro_var="CODE:VERSION BUILD=8530828 RECORDER=FX\n";
macro_var+="TAB T=1\n";
macro_var+="URL GOTO=http://www.example.com/testim.html\n";
macro_var+="TAG POS=1 TYPE=BODY ATTR=TXT:* EXTRACT=TXT\n";

iimPlay(macro_var);

var result=iimGetLastExtract();

if(result=="Done"){
iimDisplay("success");
}


来源:https://stackoverflow.com/questions/21207747/imacros-if-else-javascript-simple

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!