Break JavaScript When run document.forms[0].submit();

Break JavaScript When run document.forms[0].submit();

本文关键字:submit When JavaScript run document forms Break      更新时间:2023-09-26
onchange="document.forms[0].action = 'policyTypeSelection.do?method=policyTypeSelection'; document.forms[0].submit(); optionCheck(this);">

optionCheck(this);是Java脚本:

function optionCheck(frm) {
    var i, len, optionVal, helpDiv, btnStatus,
    selectOptions = document.getElementById("options").submit();
    // loop through the options in case there
    // are multiple selected values
    for (i = 0, len = selectOptions.options.length; i < len; i++) {
        // get the selected option id
        optionVal = selectOptions.options[i].id;
        // find the corresponding help div
        helpDiv = document.getElementById("help");
        Statussecond = document.getElementById("second");
        Statusfirst = document.getElementById("first");
        // move on if we didn't find one
        if (!helpDiv) { continue; }
        // set CSS classes to show/hide help div
        if (selectOptions.options[i].selected) {
            helpDiv.className = "helpTextShow";
            Statussecond.className = "hiddenShow";
            Statusfirst.className = "none";
        }
    }
}

document.getElementById("options"(.submit(( 应更改为document.getElementsByTagName("option"(

而且在检查之前提交是不合理的。如果 document.forms[0].submit(( 提交表单,页面将被重新加载,并且永远不会执行 optionCheck(this(。