Jquery 使用window.location.replace呈现页面而不调用.ready函数windows phone 7 phonegap项目

Jquery 使用window.location.replace呈现页面而不调用.ready函数windows phone 7 phonegap项目,jquery,windows-phone-7,cordova,Jquery,Windows Phone 7,Cordova,使用Cordova 2.4.0-Windows Phone 7 我厌倦了从index.html导航到另一个html页面, html页面已成功呈现,控制台显示 GapBrowser_导航::/app/www/viewmohalfadetals.html <script type="text/javascript" charset="utf-8" src="cordova-2.4.0.js"></script> <script type="text/javascript

使用Cordova 2.4.0-Windows Phone 7

我厌倦了从index.html导航到另一个html页面, html页面已成功呈现,控制台显示

GapBrowser_导航::/app/www/viewmohalfadetals.html

<script type="text/javascript" charset="utf-8" src="cordova-2.4.0.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<script src="Scripts/ViewMokhalfaDetails.js" type="text/javascript"></script>
这样,viewmohalfadetals.html是目标页面,但未执行任何脚本 尽管我已经在viewmohalfadetals.html的标题中包含了js文件

<script type="text/javascript" charset="utf-8" src="cordova-2.4.0.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<script src="Scripts/ViewMokhalfaDetails.js" type="text/javascript"></script>
我不知道.ready中的代码为什么没有成功执行

更新1 我在js文件中的函数中添加了一个按钮和绑定onclick事件 它的功能与.ready函数相同 所以问题出在.ready()函数中

更新2
使用window.location.replace后,目标页面中的localStorage[“从第一页输入的密钥”]将被清除。

这是因为您转换到其他html页面的方式。如果单击按钮,请尝试向按钮标记或锚定标记添加以下内容:

rel="external"
如果要以编程方式转到其他页面,请尝试在关闭body标记后将脚本放在页面末尾,如下所示:

</body>

<script type="text/javascript">

$(document).ready(function () {console.log("Hello from .ready function")} );
</script>

</html>

$(document.ready(函数(){console.log(“Hello from.ready函数”)});

javascript文件viewmohalfadetals.js是否位于脚本文件夹中?并检查脚本中“S”的大写。是的,所有内容都在正确的位置,其他页面工作正常我不知道为什么这个页面特别有错误,顺便说一句,我尝试将标记中的.ready代码移动到HTML本身中,但同样的问题也发生了!!您可以尝试在浏览器(可能是chrome)中独立运行此页面,并检查控制台是否有任何错误。经过测试,未触发任何错误,顺便说一句,我已经测试了跨浏览器的页面,即chrome和FireFoxtry将jquery脚本放在cordova脚本之前。我在所有页面中都执行了您的建议,但仍然没有在所需页面中触发。准备好了吗(