我一直在试图找出什么不对的,过去几年分钟..jQuery的不工作我的ASP页面
<%@ Page Title="test" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>
<%@ PreviousPageType VirtualPath="~/Top.aspx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
<style>
#pagediv { width: 1500px !important; }
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#ddModel").change(function() {
var selVal = $(this).find(":selected").text();
var rows = $("#gvTop tr:gt(0)");
alert(selVal);
if (selVal == "ALL") {
$("#gvTop tr").show();
}
else {
var rowToShow = rows.find("td:eq(3)").filter(":contains(" + selVal + ")").closest("tr");
rows.show().not(rowToShow).hide();
}
});
});
</script>
</asp:Content>
仍然不知道现在。
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<asp:DropDownList ID="ddModel" runat="server" DataSourceID="ddmodelsource" DataTextField="Column1" DataValueField="Column1">
</asp:DropDownList>
<asp:GridView ID="gvTop" runat="server" CellPadding="2" CellSpacing="2" GridLines="Vertical">
</asp:GridView>
</asp:Content>
什么是“不工作”? jQuery的加载(测试通过做一个警报('jquery加载');在你的$(document).ready(function ... 当你用萤火虫测试页面时,你会看到它被加载或任何JavaScript错误吗? – Raoul 2011-05-20 08:47:05
它会执行一些意想不到的事情,或者代码根本就没有执行?它是否在最小化的非ASP HTML-Prototype中工作? – 2011-05-20 08:48:49
@Raoul @jm_在$(“#ddModel”)之前添加一个警报change(function() {'但是alert()里面的那个函数不起作用,我是用错误的方式调用了id的 – 2011-05-20 08:51:38