<script type="text/javascript">
function PreselectMyItem(itemToSelect)
{
// Get a reference to the drop-down
var myDropdownList = document.IssuesToReportForm.ReportTo;
// Loop through all the items
for (iLoop = 0; iLoop< myDropdownList.options.length; iLoop++)
{
if (myDropdownList.options[iLoop].value == itemToSelect)
{
// Item is found. Set its selected property, and exit the loop
myDropdownList.options[iLoop].selected = true;
break;
}
}
}
</script>
IssuesToReportForm
가정하면 양식 이름과 ReportTo
드롭 다운의 이름입니다.
그런 다음 <body onLoad="PreselectMyItem('<%=strReportTo%>')">
Source
SelectedValue는 .NET 일 ... 자바 스크립트를 사용하여, 당신은 단지 selectedIndex의를 설정할 수 있습니다. 더 자세한 정보가 있습니까? – Dave
내가 제공 한 기능을 사용하여 요소를 반복하는 것이 트릭을 수행하고 시도하지는 않았다고 생각합니다. – johnnyArt