我希望你能帮助我。jquery自动完成功能在localhost上不起作用
我在localhost aspx页面上使用了下面的代码,所以它自动完成。
它工作完美。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<link rel="stylesheet" href="http://dev.jquery.com/view/trunk/plugins/autocomplete/demo/main.css" type="text/css" />
<link rel="stylesheet" href="http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.css" type="text/css" />
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.bgiframe.min.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.dimensions.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.js"></script>
<script>
$(document).ready(function(){
var data = "Core Selectors Attributes Traversing Manipulation CSS Events Effects Ajax Utilities".split(" ");
$("#example").autocomplete(data);
});
</script>
</head>
<body>
API Reference: <input id="example" /> (try "C" or "E")
</body>
</html>
*但是,当我下载脚本等,并在我的本地服务器上运行(参见下面的代码),这是行不通的,它并没有给我任何错误 页面确实需要约10秒加载(而不是< 1秒)
自动完成功能在页面上不起作用,但其他所有功能都不起作用。
谁能告诉我我做错了什么?有什么我必须额外打开本地或下载?
我对此非常感兴趣,所以感谢您的光临。
此外,我想数据来自一个文件,而不是可变数据。
我已经下载了所谓的“jQuery的1.3.2.min.js”以及和把它放在同一目录中的其他脚本文件...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Page Language="C#" %>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta content="es" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Search POL-POD</title>
<style type="text/css">
.tahoma_small {
font-family: Tahoma;
font-size: x-small;
}
</style>
<script src="../autocomplete/jquery-latest.js"></script>
<link rel="stylesheet" href="../autocomplete/jquery.autocomplete.css" type="text/css" />
<script type="text/javascript" src="../autocomplete/jquery.autocomplete.js"></script>
<script>
$(document).ready(function() {
var data = "Core Selectors Attributes Traversing Manipulation CSS Events Effects Ajax Utilities".split(" ");
$("#txtfirst").autocomplete(data);
$("#txtsecond").autocomplete(data);
});
</script>
</head>
<body>
<form id="form1" runat="server" enableviewstate="False" autocomplete="True">
POL
<asp:TextBox id="txtfirst" runat="server"></asp:TextBox>
POD
<asp:TextBox id="txtsecond" runat="server"></asp:TextBox>
<asp:Button id="Button1" runat="server" Text="Button" />
<br />
....etc
验证与萤火虫(Net标签)所有必需的JavaScript文件中找到。 – 2009-11-10 09:28:01
我正在使用Visual Web Developer 2008 ...你提到的Firebug(Net标签)在哪里?对不起,我的经验不足 – frank2009 2009-11-10 09:35:57
看看Firebug:http://getfirebug.com/ – Frankie 2009-11-10 09:39:24