售前咨询 售后咨询
当前位置: 上海网站设计 > 建站知识 > 行业新闻

如何通过js隐藏跟显示信息

网站编辑:小润 | 发表时间:2019-01-18 15:47:13

如何通过js隐藏跟显示信息
 
如何隐藏用户注册信息,可显示信息显示出来,隐藏信息隐藏起来呢?以下即是使用方法
 
代码信息:
 
<!DOCTYPE html>
 
<html>
 
<head>
 
<meta charset="UTF-8">
 
<title>Insert title here</title>
 
<script type="text/javascript">
 
    function $(idvalue){
 
        return document.getElementById(idvalue);
 
    }
 
    function showtext(){
 
 if($('text').style.display == 'none'){
 
     $('text').style.display = '';
 
 }else{
 
  $('text').style.display = 'none';
 
 }
 
    }
 
</script>
 
</head>
 
<body>
 
    <div id="text" style="display:none;">这里的信息隐藏</div>
 
    <button id="morebtn" onclick="showtext();">详细的信息</button>
 
</body>
 
</html>

 

关键字:
官方微信
上海市长宁区宣化路300号华宁国际广场中区7层
+021-8031 0607
+135 8590 1130