h5+调用系统通讯录
发布时间:2018-03-15 10:09,
浏览次数:1259
Contacts Examplebody,html{
width: 100%;
height: 80%;
font-size: 62.5%;
background: rgb(245,245,245);
}
*{
margin: 0;
padding: 0;
}
ul{
list-style: none;
}
a{
text-decoration: none;
}
.list-h{
width: 95%;
padding-left: 5%;
height: 3rem;
padding-top: 1rem;
padding-bottom: 1rem;
border-bottom: 1px solid #DDDDDD;
}
.list-h>p{
display: inline-block;
width: 3rem;
height: 3rem;
border-radius: 50%;
background: #29ACBA;
line-height: 3rem;
text-align: center;
color: #FFFFFF;
}
.list-h>h3{
width: 70%;
height: 3rem;
line-height: 3rem;
font-size: 1.4rem;
display: inline-block;
margin-left: 1rem;
}
// 监听plusready事件
document.addEventListener( "plusready", function(){
}, false );
function find(){
plus.contacts.getAddressBook(plus.contacts.ADDRESSBOOK_PHONE, function
(addressbook) {
addressbook.find(["displayName","phoneNumbers"],function(contacts){
var list="";
for(var i=0;i
if(contacts[i].phoneNumbers.length > 0){
var str=contacts[i].displayName.substr(contacts[i].displayName.length -2, 2);
list+="
class='list-h'>
"+str+"
"+contacts[i].displayName+"("+contacts[i].phoneNumbers[0].value+")"+"
}else{
}
}
$("body").append(list);
}, function () {
alert("error");
},{multiple:true});
},function(e){
alert("Get address book failed: " + e.message);
});
}
安丽
安丽(15545090181)
Find
有问题的话可以来本人个人博客留言:http://www.funtechstudy.com/