document.all("div).style.display = "none"与 等于""的区别

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<td class="title">
    <Div id="divApproveMofiyReasonTitle" style="display:none"> 修改原因 </Div>
    <Div id="divApproveRejectReasonTitle" style="display:none"> 拒绝原因 </Div>
</td>
<td class="input">
    <Div id="divApproveMofiyReasonInput" style="display:none"><input class="CodeNo" name="ModifyReason" verify="修改原因|Code:EdorApproveReason" ondblclick="return showCodeList('EdorApproveReason',[this,ModifyReasonName],[0,1])" onkeyup="return showCodeListKey('EdorApproveReason',[this,ModifyReasonName],[0,1])"><input class="CodeName" name="ModifyReasonName" readonly></Div>
    <Div id="divApproveRejectReasonInput" style="display:none"><input class="CodeNo" name="RejectReason" verify="拒绝原因|Code:EdorRejectReason" ondblclick="return showCodeList('EdorRejectReason',[this,RejectReasonName],[0,1])" onkeyup="return showCodeListKey('EdorRejectReason',[this,RejectReasonName],[0,1])"><input class="CodeName" name="RejectReasonName" readonly></Div>
<td class="title"><Div id="divApproveErrorChk" style="display:none"><input name="ErrorChk" type="checkbox" onclick="setErrorFlag()" >差错件</Div></td>
</td>
<script type="text/javascript">

    function afunction(){
        document.all("divApproveRejectReasonTitle").style.display = "";
        document.all("divApproveRejectReasonInput").style.display = "";
        document.all("divApproveErrorChk").style.display = "";
    }
    setInterval(afunction,1000)
    //afunction();
    function bfunction(){
        document.all("divApproveRejectReasonTitle").style.display = "none";
        document.all("divApproveRejectReasonInput").style.display = "none";
        document.all("divApproveErrorChk").style.display = "none";
    }
    //bfunction();
    setInterval(bfunction,3000);

</script>

</body>
</html>

默认加载为  style="display:none"

  经过一秒之后设置为

.style.display = "";

  显示标签,接着3秒为

.style.display = "none";
标签消失

posted @ 2020-11-24 21:06  张艳涛&java  阅读(480)  评论(0编辑  收藏  举报