document.write清除頁(yè)面為什么在下面的代碼中,document.write在函數(shù)調(diào)用時(shí),validator()表單元素(復(fù)選框和按鈕)將從屏幕中刪除?<!DOCTYPE html><html>
<head>
<script type="text/javascript">
function validator() {
if (document.myForm.thebox.checked)
document.write("checkBox is checked");
else
document.write("checkBox is NOT checked");
}
</script>
</head>
<body>
<form name="myForm">
<input type="checkbox" name ="thebox"/>
<input type="button" onClick="validator()" name="validation" value="Press me for validation"/>
</form>
</body></html>
document.write清除頁(yè)面
溫溫醬
2019-07-24 20:49:55