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