Javascript 如何为jquery添加外部源链接?

Javascript 如何为jquery添加外部源链接?,javascript,jquery,Javascript,Jquery,我为jquery源添加了一个外部链接。但是jquery事件不会被触发。我指定的jquery源和jquery方法调用的格式正确吗 <html> <head> <title>test</title> <style>/* root element for accordion. decorated with rounded borders and gradient background image */ .accordion {

我为jquery源添加了一个外部链接。但是jquery事件不会被触发。我指定的jquery源和jquery方法调用的格式正确吗

<html>
<head>
 <title>test</title>
    <style>/* root element for accordion. decorated with rounded borders and gradient background image */
.accordion {
    background:#333;
    width: 90%;
    border:1px solid #333;    
    -background:#666;
}

/* accordion header */
.accordion h2 {
    background:#ccc url('http://static.flowplayer.org/img/global/gradient/h30.png');
    margin:0;
    padding:5px 15px;
    font-size:14px;
    font-weight:normal;
    border:1px solid #fff;
    border-bottom:1px solid #ddd;
    cursor:pointer;
    color: #000;
}

/* currently active header */
.accordion h2.current {
    cursor:default;
    background-color:#0f0;
}

/* accordion pane */
.accordion .pane {
    display:none;

    padding:15px;
    color:#fff;
    font-size:12px;
}

/* a title inside pane */
.accordion .pane h3 {
    font-weight:normal;
    margin:0 0 -5px 0;
    font-size:16px;
    color:#999;
}</style>
    <script src="//code.jquery.com/jquery-1.6.1.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            //Initialising Accordion
            $(".accordion").tabs(".pane", {
                tabs: '> h2',
                effect: 'slide',
                initialIndex: null
            });

            //The click to hide function
            $(".accordion > h2").click(function () {
                if ($(this).hasClass("current") && $(this).next().queue().length === 0) {
                    $(this).next().slideUp();
                    $(this).removeClass("current");
                } else if (!$(this).hasClass("current") && $(this).next().queue().length === 0) {
                    $(this).next().slideDown();
                    $(this).addClass("current");
                }
            });
        });
    </script>
</head>
<body>
    <div class="accordion">
    <h2>Level 1:1</h2>
    <div class="pane">
        <div class="accordion">
            <h2>Level 2 : 1</h2>
            <div class="pane">
                <div class="accordion">
                    <h2>Set 1</h2>
                    <div class="pane">
                        <div class="accordion">
                            <h2>Test3</h2>
                            <div class="pane">
                                [Pane Content]
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <h2>Level 2 : 1</h2>
            <div class="pane">
                <div class="accordion">
                    <h2>Set 1</h2>
                    <div class="pane">
                        <div class="accordion">
                            <h2>Test3</h2>
                            <div class="pane">
                                [Pane Content]
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <h2>Level 1:2</h2>
    <div class="pane">
        content
    </div>
</div>
</body>
</html>

测试
/*手风琴的根元素。用圆形边框和渐变背景图像装饰*/
.手风琴{
背景:#333;
宽度:90%;
边框:1px实心#333;
-背景:#666;
}
/*手风琴头*/
·手风琴h2{
背景:#ccc url('http://static.flowplayer.org/img/global/gradient/h30.png');
保证金:0;
填充:5px15px;
字体大小:14px;
字体大小:正常;
边框:1px实心#fff;
边框底部:1px实心#ddd;
光标:指针;
颜色:#000;
}
/*当前活动标头*/
.手风琴h2.电流{
游标:默认值;
背景色:#0f0;
}
/*手风琴窗格*/
.手风琴.窗格{
显示:无;
填充:15px;
颜色:#fff;
字体大小:12px;
}
/*窗格内的标题*/
.手风琴.窗格h3{
字体大小:正常;
边距:0 0-5px0;
字体大小:16px;
颜色:#999;
}
$(文档).ready(函数(){
//初始化手风琴
$(“.accordion”).tabs(“.pane”{
制表符:'>h2',
效果:“幻灯片”,
initialIndex:null
});
//单击以隐藏功能
$(“.accordion>h2”)。单击(函数(){
if($(this).hasClass(“当前”)和&$(this).next().queue().length==0){
$(this.next().slideUp();
$(此).removeClass(“当前”);
}else if(!$(this.hasClass(“当前”)和&$(this.next().queue().length==0){
$(this.next().slideDown();
$(此).addClass(“当前”);
}
});
});
级别1:1
第2级:1
第1组
测试3
[窗格内容]
第2级:1
第1组
测试3
[窗格内容]
级别1:2
内容

因为它不接受我的问题,说它比代码小,所以我只输入了两次。Sorry包括JqueryUI,因为选项卡是JqueryUI的一部分。您在控制台中看到的错误是什么。您是否正在尝试制作嵌套的手风琴???@MeenakshiSundaram您可以尝试吗?