<input type="hidden" id="confirm" runat ="server" value="true"/>
我前台写了这样一个隐藏域,渲染出来他的Id不知道为什么变成了'ctl00_DataList_confirm'但是我用
var I=document.getElementById('ctl00_DataList_confirm')
var I=document.getElementById('confirm')
这两个Id都得不到这个控件。这是什么原因?
我前台写了这样一个隐藏域,渲染出来他的Id不知道为什么变成了'ctl00_DataList_confirm'但是我用
var I=document.getElementById('ctl00_DataList_confirm')
var I=document.getElementById('confirm')
这两个Id都得不到这个控件。这是什么原因?
document.getElementById('<%=confirm.ClientID%>');
<style type="text/css">
.style1
{
height: 267px;
width: 1000px;
padding-top:30px;
}
.style2
{
height: 3px;
}
.style4
{
width: 405px;
}
.style5
{
height: 3px;
width: 405px;
}
.style6
{
width: 128px;
}
.style7
{
height: 3px;
width: 128px;
}
</style>
<div class="style1">
<table style="width:100%;">
<tr>
<td class="style5">
</td>
<td class="style7">
<asp:Label ID="Label4" runat="server">文件名</asp:Label>
</td>
<td class="style2" align="left">
<asp:TextBox ID="TextBox1" runat="server" Width="177px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style4">
</td>
<td class="style6">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="文件上传" Height="21px" />
</td>
<td align="left">
<asp:Label ID="Label1" runat="server"></asp:Label>
</td>
</tr>
</table>
<br />
<br />
</div><input type="hidden" id="confirm" runat ="server" value="true"/>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="DataList" runat="Server">
<input type="hidden" id="confirm" runat="server" value="true" /> <script type="text/javascript">
var ss = document.getElementById('<%=confirm.ClientID %>');
alert(ss.value);
</script></asp:Content>