<script type="text/javascript">
        function openShutManager(oSourceObj,oTargeObj,shutAble,oOpenTip,oShutTip){
            var sourceObj=typeof oSourceObj=="string"?document.getElementById(oSourceObj):oSourceObj;
            var targeObj=typeof oTargeObj=="string"?document.getElementById(oTargeObj):oTargeObj;
            var openTip=oOpenTip||"";
            var shutTip=oShutTip||"";
            if(targeObj.style.display!="none"){
                if(shutAble) return;
                targeObj.style.display="none";
                if(openTip&&shutTip){
                    sourceObj.innerHTML=shutTip;
                }
            }else{
                targeObj.style.display="block";
                if(openTip&&shutTip){
                    sourceObj.innerHTML=openTip;
                }
            }
        }
<h1><button onclick="openShutManager(this,'show1',false,'内容')">内容</button></h1>
<div id="show1">
    <span>我是隐藏的内容</span>
</div>

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐