<script language="网页特效">
function submit2()
{
var s=document.getelementbyid("ops教程");
alert(s.value); //显示正确结果,说明函数被执行
document.form.submit(); //没有按常规的submit() 去执行页面,能否有其它submit()方式}
</script><form name="form" action="" method="post" >
<select name="ops" id="ops" onchange="submit2()" >
<option value="1" > cat 1</option>
<option value="2" > cat 2</option>
<option value="3" > cat 3</option>
</select>
<input type="submit" name="submit1" value="change"> //这个submit执行正确,而js中的submit()却不执行?
</form>
分析
必须是onchange="submit.click()"
<form name="form" action="" method="post" >
<select name="ops" id="ops" onchange="submit.click()" > //这里执行了<input type="submit" name="submit" value="change">
<option value="1" > cat 1</option>
<option value="2" > cat 2</option>
<option value="3" > cat 3</option>
</select>
<input type="submit" name="submit" value="change"> //这个submit用于配合onchange="submit.click()" 才执行,如何没有这行,让onchange="submit.click()自动执行?
<input type="submit" name="submit1" value="change">
</form>