Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery错误:应为对象_Jquery - Fatal编程技术网

Jquery错误:应为对象

Jquery错误:应为对象,jquery,Jquery,这是我在aspx页面中的代码 <head runat="server"> <title></title> <script src="//Scripts/jquery-1.4.1.js" type="text/javascript"> </script> <script type="text/javascript"> $(document).ready(function () { $("#divGrid

这是我在aspx页面中的代码

<head runat="server">
<title></title>
<script src="//Scripts/jquery-1.4.1.js" type="text/javascript"> </script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#divGridView table tbody tr").mouseover(function () {
            $(this).addClass("highlightRow");
        }).mouseout(function () { $(this).removeClass('highlightRow'); })
    });       
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="divGridView">
 <asp:GridView ID="gvOpenSII" runat="server">
 </asp:GridView>

$(文档).ready(函数(){
$(“#divGridView table tbody tr”).mouseover(函数(){
$(this.addClass(“highlightRow”);
}).mouseout(函数(){$(this).removeClass('highlightRow');})
});       
当我运行这段代码时,我得到一个错误:“Jquery运行时错误:预期对象”

我想在鼠标悬停时突出显示gridview中的特定行


请帮助..

我将仔细检查脚本标记src属性。试一试

<script src="/Scripts/jquery-1.4.1.js" type="text/javascript"> </script>

或许

<script src="Scripts/jquery-1.4.1.js" type="text/javascript"> </script>

我不确定生成的是什么html,但如果找不到您要定位的元素,可能会导致问题

尝试此方法,您必须对其进行一些调整以适应您的代码,但它应该可以工作:


代码在我看来还行-可以尝试cdn来确认您可以点击jquery-假设您可以从框中进入url。我会检查脚本的位置。是否运行一个非常简单的jquery示例,即alert($('body');或者你可以使用谷歌cdn,因为它提供了详细信息。这是错误中的脚本标记非常感谢..这只是url问题。我尝试在VisualStudio中选择url选项,我的新脚本标记如下
$(function(){
    $('table tr').bind('mouseenter mouseleave',function(){
        $(this).toggleClass('highlightRow');
    });
});