如何在Mechanize中模拟javascript?

时间:2016-03-11 01:10:44

标签: javascript perl postback mechanize

如何使用JavaScript perl运行此Mechanize

function __doPostBack(eventTarget, eventArgument) {
        var theform;
        if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
            theform = document.Form1;
        }
        else {
            theform = document.forms["Form1"];
        }
        theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
        theform.__EVENTARGUMENT.value = eventArgument;
        theform.submit();
    }

1 个答案:

答案 0 :(得分:0)

$mech->form_name("Form1");
$mech->field("__EVENTTARGET", $eventTarget);
$mech->field("__EVENTARGUMENT", $eventArgument);
$mech->submit();