2012-10-23 48 views

回答

0

当你使用带有Phonegap的Jquery Mobile存在难以启动的基本javascript。下面你可以看到如何设置一个简单的hello世界。

代码:http://jsfiddle.net/zwTQ4/

<div data-role="header"> 
    <h1>My Title</h1> 
</div><!-- /header --> 

<div data-role="content">  
    <p>Hello world</p>   
</div><!-- /content --> 

<script type="text/javascript"> 
    $("#indexPage").bind(
     'pageinit',function() { 
       alert("Hello world"); 
      }); 
</script> 

0

我sugges阅读的jquerymobile, the section about events的文档。

其中第一个通知的有:

Important: Use $(document).bind('pageinit'), not $(document).ready() 
+0

是的,但存在的语义问题,使它的工作是很难的初学者用户。 我通过这个页面,并有一些问题。其他人也可能成为问题。 – RJuliao