2012-11-08 34 views
0

这是我的index.html页面如何使用jQuery的.load()函数的Windows Phone中的PhoneGap

<!DOCTYPE html> 
<html> 
<head> 

<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" /> 
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/> 

    <title>PhoneGap WP7</title> 

    <link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title" charset="utf-8"/> 

     <script type="text/javascript" charset="utf-8" src="phonegap-1.3.0.js"></script> 

    <script src="js/jquery.js"></script> 
    <script src="js/jquery.selectBox.js"></script> 
    <script src="js/jquery.selectBox.min.js"></script> 

    <script src="js/new.js"></script> 
    <script> 
     function come() 
     { 
      navigator.notification.alert("not coming"); 

      $("#new").html("hello"); 
     $("#need").load("new.html", function(){ 
     navigator.notification.alert("Done!"); 
     }); 

    } 

    </script> 
</head> 
<body> 
    <h1>Hello PhoneGap</h1> 

    <div id="new">asdsd</div> 
    <div id="hello">It is want to gone</div> 
    <div id="need"></div> 

    <input type="button" value="here" onclick="come()" /> 
</body> 
</html> 


**My new.html page is** 

<html> 
<body> 
<h2>New one</h2> 
<p id="hello">Why it is not coming to here is it any problem<p> 
</body> 
    </html> 

在这里,我想这new.html加载到我需要的ID中的index.html,但加载功能不工作,我试过上面的方式,并且它在加载函数中显示警告框,但它不显示window.html中的new.html的内容。我不明白什么是确切的问题。我的疑问是windows phone支持phonegap中的load()函数。所以请给出任何建议。

回答

0

你错过的O后"$("#hello)

尝试包裹.ready()方法内您的jQuery线:

$(document).ready(function() { 
    $("#new").html("hello world"); 
    $("#hello").load("new.html"); 
}); 
+0

谢谢marissa.c但在我的windows phone我把那一个,但它不工作。 – user1761126

+0

好的。其他几件事情:它看起来像你加载jQuery两次。这可能会导致问题。尝试删除文件。此外,是否有意在你的jQuery和选择框文件中的js之后? – marissajmc

+0

我试过那个,但它不起作用 – user1761126

相关问题