我正在嘗試將JQuery添加到我的網站,但是,我收到的錯誤確實沒有意義。嘗試在我的網站中包含JQuery的錯誤
爲我的項目的基本目錄結構如下:
list_app- Directory
list_site- Directory
templates- Directory:
jquery-1.11.0.js
list_edit.html
list_index.html
calendar- Directory:
calendar_control.css
calendar_control.js
admin- Directory
我的網站上list_edit.html的一個頁面上,有是應該提出一個下拉日曆在它獲得鍵盤焦點的文本字段。我已經從其他網站的日曆代碼中看到了它的使用情況,所以我確信我遇到的問題是我的代碼。當我到了'list_edit頁面,我得到了我的鍍鉻以下錯誤JavaScript控制檯:
'未捕獲的SyntaxError:意外的標記<':8000 /模板/ jQuery的1.11.0.js:1
但是,當我點擊鏈接源文件':8000/templates/jquery-1.11.0.js:1'時,它會顯示源文件'list_index.html'。這很奇怪,因爲我目前在list_edit.html文件中引用了jquery/javascript。
這裏是list_edit.html:
<!DOCTYPE html>
<html>
<head>
<script src="/templates/jquery-1.11.0.js"></script>
<link href="/templates/calendar/calendar_control.css"
rel="stylesheet" type="text/css"/>
<script src="/templates/calendar/calendar_control.js"
language="javascript"></script>
<title> List Management </title>
</head>
<body>
<!--Calendar Stuff-->
<table style="width:300px">
<tr>
<td> list name </td>
<td> expiration date </td>
</tr>
<tr>
<form action="" method="post"> {% csrf_token %}
<td> <input id="name" type="text" /> </td>
<td> <input id="expire_date" onfocus="showCalendarControl(this);" type="text" /> </td>
<input id="submit" type="submit" value="Save Changes" />
</form>
<!--TODO: Turn the below code into a javascript button-->
<form action="/lists/list_index" method="get">
<input id="cancel" type="submit" value="Cancel" />
</form>
</tr>
</table>
{% if invalid_edit %}
<p><b>Invalid changes:<br> {{error_msg}} </b></p>
{% endif %}
</body>
</html>
這裏是list_index.html:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<table style="width:300px">
<tr>
<td> Mailing List Name</td>
<td> Mailing List Creation Date</td>
</tr>
<tr>
<td>physics 212 mailing list</td>
<td>April 1, 2014, 9:08 p.m.</td>
<td>
<form action="/lists/list_edit" method="get">
<input name="submit" type="submit" value="Edit" />
<input name="list_id" type="hidden" value="1" />
<input name="admin_name" type="hidden" value="wasingej" />
</form>
</td>
</tr>
<tr>
<td>physics 314 mailing list</td>
<td>April 1, 2014, 9:09 p.m.</td>
<td>
<form action="/lists/list_edit" method="get">
<input name="submit" type="submit" value="Edit" />
<!--<input name="list_name" type="hidden" value="physics 314 mailing list" />-->
<input name="list_id" type="hidden" value="2" />
<input name="admin_name" type="hidden" value="wasingej" />
</form>
</td>
</tr>
</table>
<form action="/logout/" method="post"> <input type='hidden' name='csrfmiddlewaretoken' value='sJEKhPgAidml50xzYgzEHvUe1iQufPlt' />
<input name="logout" type="submit" value="logout" />
</form>
是不是jQuery與'list_edit.html'文件在同一個目錄中?...腳本標籤應該是這樣的:'' – Mottie