javascript如何实现点击一个按钮将页面table的visible设置为true
来源:百度知道 编辑:UC知道 时间:2024/07/07 07:02:34
在页面中有一个添加按钮..<asp:TemplateField>
<HeaderTemplate>
<asp:Button ID="btnAdd" runat="server" Text="添加" Width="82px" OnClientClick = "displayTable()" />
</HeaderTemplate>
</asp:TemplateField>
有一个table
<table id = "addMonthCalConfig" visible = "false" runat = "server"> 请问各位大虾..怎么实现点击这个按钮将table的visible设置为可见
<HeaderTemplate>
<asp:Button ID="btnAdd" runat="server" Text="添加" Width="82px" OnClientClick = "displayTable()" />
</HeaderTemplate>
</asp:TemplateField>
有一个table
<table id = "addMonthCalConfig" visible = "false" runat = "server"> 请问各位大虾..怎么实现点击这个按钮将table的visible设置为可见
<script language="javascript" type="text/javascript">
function displayTable()
{ var addMonthCalConfig=document.getElementById("addMonthCalConfig");
addMonthCalConfig.visible=true;
}
</script>
function displayTable()
{
var a1 = document.getElementById('<%=addMonthCalConfig.ClientID%>');
if(null != a1)
{
a1.style.display ="block";
}
}
进来学习...
<!--不知道你说的visible是不是指的CSS中的visibility,姑且认为是吧,其实操作的过程都是类似的-->
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
#table{border-collapse: collapse; border: 1px solid red;margin:20px auto; visibility:hidden; }
td{border:1px solid black; width: 100px; height: 40px; }
</style>