当我(#main).html()
第二次运行时,我的列表视图不会显示。这是我的HTML,
<body>
<div data-role="page" id="addressbook">
<div data-role="header">
<h1>Header</h1>
<form id='headlist'>
<button incline="true" id='heed'>ALL</button>
<button incline="true">Button</button>
</form>
</div>
<div data-role="content">
<ul data-role="listview" id='main'>
<li><a href="#">Page</a></li>
<li><a href="#">Page</a></li>
<li><a href="#">Page</a></li>
</ul>
</div>
</body>
我在我的.html(strComname)
功能和strComname
警报出现之前添加了一个警报,但列表视图不会出现。我正在使用query1.9.1min.js
,并且query.mobile-1.3.1.min.js
这是我的脚本
<script>
var CAT = '';
var catlist = new Array();
var addra = [] ;
catlist[0] = '5';
catlist[1] = '6';
catlist[2] = '7';
catlist[3] = '9';
addra.push('Taipei');
addra.push('London');
addra.push('USA');
addra.push('JAPAN');
addra.push('CAL');
$(document).ready(function(e) {intc();
});
function intc () {
showme ('ALL');
showmelist();
}
function showmelist(data)
{
var strComname1 = '';
for ( i = 0 ; i < catlist.length ; i ++ )
{
strComname1 = strComname1 + '<input type="submit" value="' +catlist[i] + '"'+ 'data-inline="true"'+"id='bb"+catlist[i]+"' onclick=showme('TYPE','"+"') />" ;
}
var strComname2 = '<input type="submit" value="ALL">';
var strComname3 = strComname2 +strComname1;
$('#headlist').html(strComname3) ;
}
function showme ( CAT )
{
var strComname = '' ;
switch (CAT)
{
case 'ALL':
{
for ( i = 0 ; i < addra.length ; i ++ )
{
strCode = addra[i];
strComname = strComname + "<li><a href='#"+strCode+"'"+ 'data-transition="slide">' + addra[i] + '</a></li>' + "\n" ;
}
break;
}
case 'TYPE':
{
for ( i = 0 ; i < addra.length ; i ++ )
{
strCode = addra[i] ;
strComname = strComname + "<li><a href='#"+strCode+"'"+ 'data-transition="slide">' + addra[i] + '</a></li>' + "\n" ;
}
break;
}
}
alert(strComname);
$('#main').html(strComname) ;
$('#main').listview("refresh") ;
}
</script>