JavaScript show hide div

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaScript show hide div相关的知识,希望对你有一定的参考价值。

<script>

var browserType;

if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {
   browserType= "gecko"
}

function hide() {
  if (browserType == "gecko" )
     document.poppedLayer = 
         eval('document.getElementById("addusuario")');
  else if (browserType == "ie")
     document.poppedLayer = 
        eval('document.getElementById("addusuario")');
  else
     document.poppedLayer =   
        eval('document.layers["realtooltip"]');
  document.poppedLayer.style.visibility = "hidden";
}

function show() {
  if (browserType == "gecko" )
     document.poppedLayer = 
         eval('document.getElementById("addusuario")');
  else if (browserType == "ie")
     document.poppedLayer = 
        eval('document.getElementById("addusuario")');
  else
     document.poppedLayer = 
         eval('document.layers["realtooltip"]');
  document.poppedLayer.style.visibility = "visible";
}

</script>


<a href="#" onClick="show()">Show</a>
<a href="#" onClick="hide()">Hide</a>

<div id="addusuario" style="visibility:hidden;">
Content here
</div>

以上是关于JavaScript show hide div的主要内容,如果未能解决你的问题,请参考以下文章

JavaScript Sbow Hide DIV

JavaScript--点击事件,模块可见不可见设置

jquery $('.hide-show')slice(0,12).show() 没有正确显示 div?

jQuery Show/Hide Div 根据 ajax 响应并将响应的 requestId 传递给成功 Div

如果选择了单选,则jQuery show hide div

javascript javascript hide / show