Programming/Java Script

asp.net TextBox 컨트롤 javascript에서 ID 불러오기

홍상길 2010. 2. 18. 09:48

<ASP:dropdownlist id="ddlLastName" runat="server" bla bla></asp:dropdownlist>

 

<input type=button value="clear" onclick="Clear_ddls()">

-------------------------------------------------------------------------

-- you need to use the ClientId property of the controls to know the name. try:
-------------------------------------------------------------------------
function Clear_ddls()
{
document.getElementById('<%=ddlLastName.ClientId%> ').selectedIndex =
0;
}