日期:2014-05-16 浏览次数:20326 次
<!DOCTYPE html>
<html>
<head>
<title>测试</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.css"/>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.js"></script>
<style type="text/css">
</style>
<meta charset="utf-8">
</head>
<body><div data-role="page" id="home"><div data-theme="b" data-role="header"><h1>测试</h1></div><div data-role="content">
<div my="myul" class="mybar1" style="display:;">
<a href="/album/book_view.aspx">经典表情桌面图标</a>
<br>
<a href="/album/book_view.aspx">七星瓢虫桌面图标</a>
<br>
<a href="/album/book_view.aspx">玻璃纱质感系统图标</a>
<br>
<a href="/album/book_view.aspx">电影人物标志图标</a>
<br>
<a href="/album/book_view.aspx">苹果产品桌面图标</a>
</div>
<div id="mybar">
<ul id="myul" data-role="listview" data-inset="true">
<li id="myul0"></li>
<li id="myul1"></li>
<li id="myul2"></li>
<li id="myul3"></li>
<li id="myul4"></li>
</ul>
</div>
<div id="list">
</div>
<script type="text/javascript">
var mydivs1 = document.getElementsByClassName("mybar1");
for (i=0;i<=mydivs1.length;i++)
{
var div1 = mydivs1.item(i)
//获取自定义的属性为一个id
var newul = div1.getAttribute("my")
var ma1 = div1.getElementsByTagName("a")
for(j=0;j<=ma1.length;j++)
{
ma1.item(j).setAttribute("data-ajax","false")
var myli = document.getElementById(newul + j)
myli.insertBefore(ma1.item(j),myli.childNodes[0])
}
}
</script>
</div></div></body></html>