日期:2014-05-18 浏览次数:20568 次
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default11.aspx.cs" Inherits="_20120301_Default11" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<script src="../jquery-1.3.2-vsdoc.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$("[id$=DropDownList1]").find("option").each(function(){
if($(this).text() != $("[id$=TextBox1]").val())
{
return false;
}
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Text="aaa" Value="aaa"></asp:ListItem>
<asp:ListItem Text="bbb" Value="bbb"></asp:ListItem>
<asp:ListItem Text="ccc" Value="ccc"></asp:ListItem>
<asp:ListItem Text="ddd" Value="ddd"></asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="TextBox1" runat="server" Text="bbb"></asp:TextBox>
</div>
</form>
</body>
</html>
------解决方案--------------------
var find=false;
var value=$("#text").val();
$("select").children("option").each(function(){
if($(this).val()==value){
find=true;
return false;
}
});
if(find){ //找到
}