欢迎访问我的个人博客:三秋邦

javascript獲得服務器端控件的ID

View Code
 1 <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
2
3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml">
5 <head runat="server">
6 <title></title>
7 <%--
8 <script type="text/javascript">
9 function E() {
10 var ary = document.getElementById("<%=TextBox1.ClientID %>");
11 var b = ary.tagName;
12 alert(ary+""+b);
13 }
14 </script>--%>
15
16 </head>
17 <body>
18 <form id="form1" runat="server">
19 <div>
20 <asp:Button runat="server" ID="btn" Text="asd" />
21 <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
22 <input type="button" onclick="E();" value="ssss" />
23 </div>
24 </form>
25 </body>
26 </html>

 不知道大家還有什麼好的方法不?

posted @ 2011-12-28 17:41  追夢  阅读(361)  评论(1编辑  收藏  举报
欢迎访问我的个人博客:三秋邦