gpt4 book ai didi

javascript - 无法在 Firefox 中使用 jQuery 脚本

转载 作者:行者123 更新时间:2023-11-28 12:51:14 26 4
gpt4 key购买 nike

我有以下script在我的主页

$(function () { // same as $(document).ready(function () { })
// assuming we have the open class set on the H2 when the HTML is delivered
$('li.drawer h2:not(.open)').next().hide();

$('h2.drawer-handle').click(function () {
// find the open drawer, remove the class, move to the UL following it and hide it
$('h2.open').removeClass('open').next().hide();

// add the open class to this H2, move to the next element (the UL) and show it
$(this).addClass('open').next().show();
});
});

它适用于 Safari,但不适用于 Firefox 3.08/3.1 beta3。

如何让上述 jQuery 脚本在 Firefox 中工作?

[编辑]

index.html 的第一行

<!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" lang="en" xml:lang="en">

<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"/>
<link href="template.css" type="text/css" rel="stylesheet"/>
<title>Abc</title>

<script type="text/javascript" src="jquery.js" />

<script type="text/javascript">

! - - - - Above Code is at Here - - - - -

</script>

</head>

index.html 的正文

<body>
<div class="mainbody">

<h1 class="myheader">Test</h1>
<p>Test</p>

<ul class="drawers">

<li class="drawer">
<h2 class="drawer-handle open">Contact info</h2>
<ul>

<li>name
</li>

<li>
<div class="">aaa
</div>
</li>
</ul>
</li>

<li class="drawer">
<h2 class="drawer-handle">Unpublished</h2>
<ul>
<li class="italic">
<i>A</i> (2009).
</li>
<li class="italic">
<i>aaa</i> (2008).
</li>
</ul>
</li>

<li class="drawer">
<h2 class="drawer-handle">Recent projects</h2>
<ul>
<li class="italic">
Websites
</li>

<li class="italic">
Search
<form action="http://www.google.com/cse" id="cse-search-box">
<div>
<input type="hidden" name="cx" value="8834479:1qd7hky6khe" />
<input type="hidden" name="ie" value="UTF-8" />
<input type="text" name="q" size="31" />
<input type="submit" name="sa" value="Search" />
</div>
</form>
<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script>
</li>

</ul>
</li>

</ul>


</div>

</body>
</html>

最佳答案

它在 Firefox 3.0.9 中适用于我

究竟是什么不起作用?

关于javascript - 无法在 Firefox 中使用 jQuery 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/794584/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com