jquery脚本未运行

jquery脚本未运行,jquery,html,Jquery,Html,我有两页。第一个是index.html,它有一个脚本来加载第二个页面。第二个页面有一个jquery脚本,该脚本应该运行并显示警报 在下面显示的代码中,我删除了所有额外的内容以简化我的问题 index.html的代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org

我有两页。第一个是index.html,它有一个脚本来加载第二个页面。第二个页面有一个jquery脚本,该脚本应该运行并显示警报

在下面显示的代码中,我删除了所有额外的内容以简化我的问题

index.html的代码:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v = "urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />

    <title>Testing</title>
    <link type="text/css" rel="stylesheet" href="./review/includes/look.css" />
  </head>
  <body class="review offline" tabindex="0">
    <div id="sidepanel" class="hidden">
      <div class="section" >
        <div id="navigation" class="rounded-border">
          <ul id="navigationtree">
            <li class="leaf last" title="Home">
              <ins class="icon">&nbsp;</ins><a href="screens/alertPage" tabindex="-1"></a>
            </li>
          </ul>
        </div>
      </div>
    </div>
    <div id="jim-mainWindow">
        <div id="jim-body" class="full web" >
            <div id="simulation" class="firer"></div>

        </div>
    </div>

    <script type="text/javascript" src="./review/includes/j.js"></script>
    <script type="text/javascript">jQuery(document).ready(function(){jimMain.init("screens/alertPage");});</script>
  </body>
</html>

测试
jQuery(document).ready(函数(){jimMain.init(“screens/alertPage”);});
第二页的代码为:

<html>
  <body>

    <script src="jquery-1.10.1.js"></script>
    <script>
        jQuery(document).ready(function(){
            alert("hi there");
            }
        }
    </script>
  </body>
</html>

jQuery(文档).ready(函数(){
警惕(“你好”);
}
}
1) 我已确保jquery-1.10.1.js页面与alertPage.html位于同一目录中 2) 我已经通过从UI添加到alertPage并查看它的呈现,验证了alertPage.html实际上是由index.html加载的

我在这里遗漏了什么?

遗漏了
,额外
}

jQuery(document).ready(function(){
    alert("hi there");
    //Remove the }
}); //<---Add the );
jQuery(文档).ready(函数(){
警惕(“你好”);
//删除}
}); // 缺少
,额外
}

jQuery(document).ready(function(){
    alert("hi there");
    //Remove the }
}); //<---Add the );
jQuery(文档).ready(函数(){
警惕(“你好”);
//删除}

}); // 在jQuery中加载后加载自定义js


jQuery(文档).ready(函数(){
警惕(“你好”);
});

在jQuery中加载后加载自定义js


jQuery(文档).ready(函数(){
警惕(“你好”);
});


您忘记在编写的第一个html文件中包含
jquery
。准备好了吗(…}@karthikr index.html有j.js,正如我所说,它正在正确加载第二个alertPage.html。如果是,请不要再加载第二个页面…因为它将覆盖原始页面上的jquery。加载包含javascript的html通常是个坏主意。@kevin如果我要从aler移动脚本的话t页面到index.html我可以从index.html中的脚本中引用alertPage.html中的div吗?您忘记在编写的第一个html文件中包含
jquery
。准备好了吗(…}@karthikr index.html有j.js,正如我所说,它正在正确加载第二个alertPage.html。如果是,请不要再加载第二个页面…因为它将覆盖原始页面上的jquery。加载包含javascript的html通常是个坏主意。@kevin如果我要从aler移动脚本的话t页面到index.html我可以从index.html中的脚本中引用alertPage.html中的div吗?这不起作用。仍然看不到警报弹出窗口。我正在最新版本的firefox上测试。这不起作用。仍然看不到警报弹出窗口。我正在最新版本的firefox上测试。这没有做任何更改。自定义js是在index.html上,jquery-1.10.1.js正在alertPage.html上加载。自定义js文件是否包含jquery?如果是,您需要将其包含在index.html中。我按照您的建议包含了该行,但这并没有改变输出。@codennija-grrr!!!确定更新您的问题以包含自定义js,我将尝试重现错误使用您的所有代码。这没有做任何更改。自定义js位于index.html上,而jquery-1.10.1.js正在alertPage.html上加载。自定义js文件是否包含jquery?如果是,您需要将其包含在index.html中。我按照您的建议包含了该行,但这并没有更改输出。@codennija-grrr!!!确定更新您的问题为了包含您的自定义js,我将尝试使用您的所有代码重现错误。