选择确认后提交输入的内容,这在做程序时非常实用

- 站长中国 (http://www.zzchina.net)
-- 网页特效 (http://www.zzchina.net/javascript/)
--- 选择确认后提交输入的内容,这在做程序时非常实用 (http://www.zzchina.net/javascript/1/756.htm)
-- 发布日期: 2005-07-06
<!-- 网页特效代码由[站长中国:http://www.zzChina.net]提供! -->
<!-- 要实现此效果需要 1 个步骤: -->

<!-- 第 1 步: -->
<!-- 把下面的代码加到<BODY></BODY>区域中: -->

<script>

var checkobj

function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){ //hunt down submit button
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!checkobj.checked
}
}
}

function defaultagree(el){
if (!document.all&&!document.getElementById){
if (window.checkobj&&checkobj.checked)
return true
else{
alert("Please read/accept terms to submit form")
return false
}
}
}

</script>
<form name="agreeform" onSubmit="return defaultagree(this)">
<input name="agreecheck" type="checkbox" onClick="agreesubmit(this)"><b>你确认这些都是正确的了吗?</b><br>
<input type="Submit" value="提交" disabled>
</form>
<script>
//change two names below to your form's names
document.forms.agreeform.agreecheck.checked=false
</script>


zzchina.net