Javascript 如何使用phonegap将数组值加载到iphone应用程序的tableview中
我是phonegap的新手。现在我在我的Lion mac中使用phonegap2.0。我的xcode版本是4.3。现在,我使用html为iphone应用程序创建了Tableview。我使用JavaScript创建了带有一些值的数组。请看下面的链接:在下面的链接中,我附加了我的html文件和Javascript文件Javascript 如何使用phonegap将数组值加载到iphone应用程序的tableview中,javascript,html,cordova,Javascript,Html,Cordova,我是phonegap的新手。现在我在我的Lion mac中使用phonegap2.0。我的xcode版本是4.3。现在,我使用html为iphone应用程序创建了Tableview。我使用JavaScript创建了带有一些值的数组。请看下面的链接:在下面的链接中,我附加了我的html文件和Javascript文件 "http://pastie.org/4779045" 现在我想在tableview中加载数组值。请有人帮我加载这个问题。这是一个示例代码 HTML部分: <!--HTML c
"http://pastie.org/4779045"
现在我想在tableview中加载数组值。请有人帮我加载这个问题。这是一个示例代码
HTML部分:
<!--HTML code -->
<ul data-role="listview" data-inset="true" id="lstMyList">
</ul>
Javascript
/*javascript code*/
var i;
var names= new Array();
names[0] = "Gopi";
names[1] = "Vinoth";
names[2] = "Yuvaraj";
for (i=0;i<names.length;i++){
$('#lstMyList').append('<li><a href="#">'+names[i]+'</a></li>');//append list items to the list view dynamically
}
//If you add items to a listview, you'll need to call the refresh() method on it to update the styles and create any nested lists that are added.
$('#lstMyList').listview("refresh");
/*javascript代码*/
var i;
变量名称=新数组();
名称[0]=“Gopi”;
名称[1]=“维诺”;
姓名[2]=“Yuvaraj”;
对于(i=0;它对我不起作用。不显示我的listview。