62,267
社区成员
发帖
与我相关
我的任务
分享<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
window.onload=function(){
var dropTest = document.getElementById("dropTest");
dropTest.options[0].text="全国";
}
</script>
</head>
<body style="height: 2000px;">
<select name="dropTest" id="dropTest">
<option value="0">所有省份</option>
<option value="1">湖北省</option>
<option value="1">河北省</option>
<option value="1">河南省</option>
</select>
</body>
</html>
<script src="JScript/jquery-1.7.2.min.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
$(function(){
$("#dropTest option[value='0']").remove();
$("#dropTest").prepend("<option value='0'>全国</option>");
$("#dropTest").get(0).selectedIndex=0;
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:DropDownList ID="dropTest" runat="server">
<asp:ListItem Text="所有省份" Value="0"></asp:ListItem>
<asp:ListItem Text="湖北省" Value="1"></asp:ListItem>
<asp:ListItem Text="河北省" Value="1"></asp:ListItem>
<asp:ListItem Text="河南省" Value="1"></asp:ListItem>
</asp:DropDownList>
</form>
</body>
</html>