当前位置: 代码迷 >> ASP.NET >> js控制隐藏按钮有关问题
  详细解决方案

js控制隐藏按钮有关问题

热度:3026   发布时间:2013-02-25 00:00:00.0
js控制隐藏按钮问题
js如何控制隐藏按钮,为什么我这样写document.getElementById('InsertButton').style.display="none";按钮没有隐藏呢?


------解决方案--------------------------------------------------------
没有问题啊
HTML code
<!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>  <title> new document </title>  <meta name="generator" content="editplus" />  <meta name="author" content="" />  <meta name="keywords" content="" />  <meta name="description" content="" /> </head> <body>  <button onclick="this.style.display='none';">点我</button> </body></html>
------解决方案--------------------------------------------------------
探讨
点按钮后重新刷新页面 所以按钮又显示出来了

------解决方案--------------------------------------------------------
既然楼主用的是服务器控件,就可以有两种方法将Button隐藏!
1.InsertButton.Visible=false;

2.InsertButton.Attributes.Add("style", "display:none");
这样做刷新也不会显示滴!!
------解决方案--------------------------------------------------------
JS前台 document.getElementById('InsertButton').style.display='none';
C#后台 InsertButton.Visible=false 
  相关解决方案