1. ReadOnly 속성처럼 사용하기
var cbo = document.getEle mentById("<%=DropdownList.ClientID%>");
cbo.disabled = true
var cbo = document.getEle mentById("<%=DropdownList.ClientID%>");
cbo.disabled = true
2. 선택된 Value 값 알아오기
var cbo = document.getElementById("<%=DropdownList.ClientID%>");
var cbo = document.getElementById("<%=DropdownList.ClientID%>");
cbo.value;
3. 선택된 Value 값 선택하기
var cbo = document.getElementById("<%=DropdownList.ClientID%>");
var cbo = document.getElementById("<%=DropdownList.ClientID%>");
for(var nIndex = 0; cbo.length > nIndex; nIndex++)
{
if(cbo [nIndex].value == strCompany)
{
cbo [nIndex].selected = true;
}
}
{
if(cbo [nIndex].value == strCompany)
{
cbo [nIndex].selected = true;
}
}
4. 선택된 Text 값 알아오기
var cbo = document.getElementById("<%=DropdownList.ClientID%>");
cbo.options[cbo.selectedIndex].text;
5. 선택된 Text 값 선택하기
var cbo = document.getElementById("<%=DropdownList.ClientID%>");
for(var nIndex = 0; cbo.length > nIndex; nIndex++)
{
if(cbo.options[nIndex].text == strCompany)
{
cbo.options[nIndex].selected = true;
}
}
댓글 없음:
댓글 쓰기