日期:2014-05-17  浏览次数:20388 次

新手求教一个简单的JS问题

我不知道为什么我一选择就提醒我 if ($("ttt").value == "样机")对象缺失,求大神指点


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"  ValidateRequest="false"  Inherits="test._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script type="text/javascript">
        function getYangJiInfo(obj) {

            
              if ($("ttt").value == "样机") {

                    alert("请填写公司型号");

            }
            
        }



</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>test</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:DropDownList ID="ttt" runat="server" onchange="getYangJiInfo(this);"
           >
            <asp:ListItem Value="样机1">样机1</asp:ListItem>
            <asp:ListItem>样机2</asp:ListItem>
            <asp:ListItem>样机3</asp:ListItem>
            <asp:ListItem>样机</asp:ListItem>
        </asp:DropDownList>
        

        
        <asp:TextBox ID="公司型号" runat="server"></asp:TextBox>
    </div>
    
    </form>
</body>
</html>