代码之家  ›  专栏  ›  技术社区  ›  Ashish Gupta Shiva

JQuery-Microsoft JScript运行时错误:需要对象

  •  3
  • Ashish Gupta Shiva  · 技术社区  · 15 年前

    Microsoft JScript runtime error: Object expected
    

    当我在没有调试的情况下运行时,我得到以下javascripterror:-

    Line: 10
    Error: 'jQuery' is undefined
    

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
    
    <!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-ui-1.7.1.custom.min.js" type="text/javascript"></script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <script>$(function () { alert('hello') });</script> 
    
        </div>
        </form>
    </body>
    </html>
    
    3 回复  |  直到 15 年前
        1
  •  12
  •   fredrik    15 年前

    jqueryui不包含基jQuery。你需要在UI-js之前导入它。

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    

    …弗雷德里克

        2
  •  0
  •   Bhaskarreddy Mule    13 年前
        3
  •  0
  •   Kendon Darlington    6 年前

    我有同样的问题与ASP网站。我从min.js链接调用Jquery,通过将Jquery添加到我的项目并调用它来解决问题。

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js" 
    type="text/javascript"></script>
    

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

    Chrome在使用URL版本时没有任何问题,但是internetexploder出于某种原因出现了问题。