imacros javascript window.onload不工作

时间:2016-02-06 00:11:25

标签: javascript dom onload imacros onload-event

我已经运行了几次我的脚本,无法弄清楚为什么window.onload不起作用。我做得不对劲?

 var macro = "CODE:";
 macro += "VERSION BUILD=9002379" + "\n";
 macro += "TAB T=1" + "\n";
 macro += "TAB CLOSEALLOTHERS" + "\n";
 macro += "SET !EXTRACT_TEST_POPUP YES" + "\n";
 macro += "SET !TIMEOUT_STEP 60" + "\n";
 macro += "SET !TIMEOUT_PAGE 60" + "\n";
 macro += "SET !ERRORIGNORE YES" + "\n";
 macro += "SET !DATASOURCE C:\\imacros\\test.csv" + "\n";
 macro += "SET !DATASOURCE_COLUMNS 1" + "\n"
 macro += "SET !DATASOURCE_LINE 1" + "\n";
 macro += "URL GOTO={{!COL1}}" + "\n";
 function addlisteners(){
 window.alert("Boo !");
 }
 window.onload = addlisteners;

 iimPlay(macro);

1 个答案:

答案 0 :(得分:1)

I am not sure what you tried to do with the script above but this code works fine.

    var macro = "CODE:";
    macro += "VERSION BUILD=9002379" + "\n";
    macro += "TAB T=1" + "\n";
    macro += "TAB CLOSEALLOTHERS" + "\n";
    macro += "SET !EXTRACT_TEST_POPUP YES" + "\n";
    macro += "SET !TIMEOUT_STEP 60" + "\n";
    macro += "SET !TIMEOUT_PAGE 60" + "\n";
    macro += "SET !ERRORIGNORE YES" + "\n";
    macro += "SET !DATASOURCE C:\\imacros\\test.csv" + "\n";
    macro += "SET !DATASOURCE_COLUMNS 1" + "\n"
    macro += "SET !DATASOURCE_LINE 1" + "\n";
    macro += "URL GOTO={{!COL1}}" + "\n";




    iimPlay(macro);

   addlisteners();


    function addlisteners() {
        alert("Boo !");
    }

现在怎么样?