1

有谁知道这个谷歌代码是如何工作的?

我得到以下信息:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>My Google AJAX Search API Application</title>
    <script src="http://www.google.com/jsapi?key=blahblahblah" type="text/javascript"></script>
    <script language="Javascript" type="text/javascript">
  google.load("jquery", "1");
   google.load("jqueryui", "1");
    </script>
  </head>
  <body>
   <div class="ui-state-highlight">
    hello world
   </div>
  </body>
</html>

但是,<div></div>应该显示带有 hello world 的错误框。但它没有显示红色背景,因此 ui 无法正常工作......

我在这里做错了什么?

4

3 回答 3

5

如果您想要样式,您还需要样式表,如下所示:

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css"> 

这是基本(灰色)主题,还有其他主题(请务必更新版本号!)

除非您需要google.load其他东西,否则您可以直接包含脚本,值得查看这个问题以了解使用google.load().

直接加载它们看起来像这样:

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>
于 2010-05-23T14:27:55.923 回答
0

hello world 应该显示出来,但是因为找不到类 ui-state-hightlight,所以 hello world 只显示为纯文本。

于 2010-05-23T14:29:36.667 回答
0

它使用<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css">

你也可以在这里推出自己的风格

http://jqueryui.com/themeroller/
于 2010-05-23T14:55:45.480 回答