1
我已經使用了代碼從http://jqueryui.com/autocomplete/#default這是在FF和Chrome罰款,但不適用於IE8版本8.0.7600.16385。開發者控制檯中規定Jquery autocomplere在IE8中不工作
「空」爲空或不是對象
有什麼不對?
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Web.XXX.XXX.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta charset="utf-8" />
<title>jQuery UI Autocomplete - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function()
{
var availableTags = ["ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme"];
$("#tags").autocomplete({ source: availableTags });
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div class="ui-widget">
<label for="tags">Tags: </label>
<input type="text" id="tags" />
</div>
</form>
</body>
</html>
定義 「不工作」。你在控制檯中遇到錯誤嗎?調試時會發生什麼?你的電腦爆炸了嗎?如果將'.autocomplete()'聲明移至HTML文檔的最後,會發生什麼? DOM加載順序很重要。 – 2013-02-27 11:27:00
是的,在IE中的開發人員工具中,我得到「'null'爲空或不是對象」的錯誤..即使在HTML中移動它後仍然得到相同的錯誤。 – NSP 2013-02-27 11:34:13