<head runat="server">
<title>动态添加option</title>
<script>
function myclick()
{
WebService.GetDayEnum(onSuccess);
}
function onSuccess(result)
{
var myselect= document.getElementById("myselect");
for(var i=0;i<8;i++)
{
myselect.options[i] = new Option(result[i],i);
}
}
</script>
</head>
<body οnlοad="myclick();">
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/WebService.asmx" />
</Services>
</asp:ScriptManager>
<div>
<input type="button" value="test" οnclick="myclick();"/>
<select id="myselect">
</select>
</div>
</form>
</body>
<title>动态添加option</title>
<script>
function myclick()
{
WebService.GetDayEnum(onSuccess);
}
function onSuccess(result)
{
var myselect= document.getElementById("myselect");
for(var i=0;i<8;i++)
{
myselect.options[i] = new Option(result[i],i);
}
}
</script>
</head>
<body οnlοad="myclick();">
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/WebService.asmx" />
</Services>
</asp:ScriptManager>
<div>
<input type="button" value="test" οnclick="myclick();"/>
<select id="myselect">
</select>
</div>
</form>
</body>