html - Break JavaScript When run document.forms[0].submit(); -
html - Break JavaScript When run document.forms[0].submit(); -
onchange="document.forms[0].action = 'policytypeselection.do?method=policytypeselection'; document.forms[0].submit(); optioncheck(this);">
optioncheck(this);
java script :
function optioncheck(frm) { var i, len, optionval, helpdiv, btnstatus, selectoptions = document.getelementbyid("options").submit(); // loop through options in case there // multiple selected values (i = 0, len = selectoptions.options.length; < len; i++) { // selected alternative id optionval = selectoptions.options[i].id; // find corresponding help div helpdiv = document.getelementbyid("help"); statussecond = document.getelementbyid("second"); statusfirst = document.getelementbyid("first"); // move on if didn't find 1 if (!helpdiv) { continue; } // set css classes show/hide help div if (selectoptions.options[i].selected) { helpdiv.classname = "helptextshow"; statussecond.classname = "hiddenshow"; statusfirst.classname = "none"; } } }
document.getelementbyid("options").submit() should changed document.getelementsbytagname("option")
and it's unreasonable submit before checking. if document.forms[0].submit() submit form,the page reloaded , optioncheck(this) never executed.
javascript html
Comments
Post a Comment