未捕获的SyntaxError:意外的令牌<

时间:2013-09-03 13:21:56

标签: javascript jquery .net

当我只是尝试在我的.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>

1 个答案:

答案 0 :(得分:0)

尝试从头标记

中删除runat="server"
<head>
    <title>Merchants TotalView</title>
    <script src="scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
</head>