今天图老师小编给大家精心推荐个JS、CSS 简单的控制层的现实与隐藏教程,一起来看看过程究竟如何进行吧!喜欢还请点个赞哦~
【 tulaoshi.com - Web开发 】
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" 
html xmlns="http://www.w3.org/1999/xhtml" 
head 
meta http-equiv="Content-Type" content="text/html; charset=gb2312" / 
titleJS、CSS 简单的控制层的现实与隐藏—Y7L8’Blog/title 
style 
body{margin:0 auto;text-align:center;padding-top:180px;} 
div{width:100px;height:200px;background:#f00;margin:0 auto 10px;} 
/style 
/head 
body 
div id="test" style="display:block"JS、CSS 简单的控制层的现实与隐藏—Y7L8’Blog/div 
input type="button"  value="隐藏"; id="clickbutton" 
script type="text/javascript" 
    var obj=document.getElementById("test"); 
    document.getElementById("clickbutton").onclick=function (){ 
        if(obj.style.display=="block"){ 
             obj.style.display="none"; 
             document.getElementById("clickbutton").value="显示";        } 
       else{ 
           obj.style.display="block"; 
           document.getElementById("clickbutton").value="隐藏";       } 
} 
/script 
/body 
/html 
来源:http://www.tulaoshi.com/n/20160219/1606577.html
看过《JS、CSS 简单的控制层的现实与隐藏》的人还看了以下文章 更多>>