1

当我尝试在我的 .Net 页面中包含 jQuery 1.9.1 时,我收到错误“Uncaught SyntaxError: Unexpected token <”。该页面的代码如下。我检查了我的 jQuery 1.9.1 文件,这很好,我有其他页面使用相同的文件,没有错误。我什至尝试过使用 jQuery 1.10.2 并得到了同样的错误。如果没有 jQuery 脚本标签,我就没有错误,而且我不知道问题是什么。

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NewLogin.aspx.cs" Inherits="Platform.Account.NewLogin" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Merchants TotalView</title>
        <script src="scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <div id="status">
                    <asp:Literal ID="litStatus" runat="server"></asp:Literal>
                </div>
                <div id="login" runat="server">
                    <asp:Label ID="lblUsername" runat="server" AssociatedControlID="txtUsername">Username:</asp:Label>
                    <asp:TextBox ID="txtUsername" runat="server"></asp:TextBox>
                    <br />
                    <asp:Label ID="lblPassword" runat="server" AssociatedControlID="txtPassword">Password:</asp:Label>
                    <asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox>
                    <br />
                    <a id="lnkForgotPass" href="NewLogin.aspx?mode=forgot">forgot password</a>
                    <a id="lnkForgotUser" href="NewLogin.aspx?mode=forgot">forgot username</a>
                    <br />
                    <asp:Button ID="btnLogin" runat="server" Text="Submit"></asp:Button>
                </div>
                <div id="forgot" runat="server">
                    <input id="hdnForgot" runat="server" type="hidden" />
                    <asp:Literal ID="litStatusMessage" runat="server"></asp:Literal><br />
                    <asp:Label ID="lblEmail" runat="server" AssociatedControlID="txtEmail">Email Address:</asp:Label>
                    <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
                    <br />
                    <asp:Button ID="btnForgot" runat="server" Text="Submit" OnClick="btnForgot_Click"></asp:Button>
                </div>
                <div id="change" runat="server">
                    change pass
                </div>
            </div>
        </form>
    </body>
</html>
4

1 回答 1

0

尝试runat="server"从 head 标签中删除

<head>
    <title>Merchants TotalView</title>
    <script src="scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
</head>
于 2013-09-03T13:28:08.010 回答