`
shappy1978
  • 浏览: 713654 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

About Contact Plugin

 
阅读更多

* Id is readonly, can't be set on adding

* Only support remove by Id

* DisplayName can't be set and read

* Sth special to set phone number

function addContact(){
//    navigator.contacts.create({"displayName":"Alex"});
    var rec = navigator.contacts.create();
    rec.id = "1";
    rec.displayName = "Alex";
    rec.nickname = "nickName";
    rec.birthday = "1978-01-01";
    var phone = [];
    phone[0] = new ContactField("work","12312341234", false);
    phone[1] = new ContactField("mobile","13312341234", true);
    phone[2] = new ContactField("home",  "13312341234", false);
    rec.phoneNumbers = phone;

    rec.name = new ContactName();
    rec.name.givenName = "givenName";
    rec.name.familyName = "familyName";
    rec.note = "Sample contact of Alex";
    rec.save(function(rec){showInfo(showContactInfo(rec))}, showInfo);
}

 

function showContactInfo(rec){
    var s=rec.id+" displayName:"+rec.displayName;
    if(rec.name){
        s +=" "+rec.name.familyName+" "+rec.name.givenName+" "+rec.name.middleName+" ";
        
    }
    if(rec.phoneNumbers){
        s += " phone";
        for(var j=0; rec.phoneNumbers[j]; j++){
            s += " "+rec.phoneNumbers[j].type+":"+rec.phoneNumbers[j].value+" ";
        }
    }
    s += "\n";
    return s;
}

 

分享到:
评论

相关推荐

    vue单页面seo(prerender-spa-plugin,vue-meta-info)

    [ '/', '/about', '/contact' ] // 根据需求添加你的路由 ) ] } } } } ``` 同时,在你的Vue组件中使用`vue-meta`来管理元信息: ```html <!-- 页面内容 --> export default { metaInfo: { title: '...

    雨哲万能单页

    联系我们 http://你的域名/plugin.php?id=yuzhepage&action=contact 二、default_open、default_title、default_temp、default_content这四个变量为插件程序需要用到的默认变量,如果你不使用可以选择关闭,请不要...

    Android代码-cssdroid

    If you're really interested in this project, contact me and we'll talk about how to make it a production ready product :) Features CSSdroid allow a minor subset of operators (inspired by less and ...

    Bootstrap 4 responsive web design

    The about section 71 The features section 73 The price table section 75 The footer 78 Forming the forms 81 Newsletter form 81 Contact form 83 The sign-in form 87 Images 89 Helpers 91 Floating and ...

    创意设计广告企业网站大气宽屏风格的模板下载.zip

    此外,模板还包含了一些技术性的文件夹和文件,如js文件夹内可能包含JavaScript脚本文件,负责实现网页的交互动效,rs-plugin可能是指用于图片轮播和幻灯片效果的插件,img文件夹存储了网站所需的所有图片资源,css...

    ICS delphixe10源码版

    - About SSL - Support - Release notes - Midware - Known problems - Special thanks Legal issues: ------------- Copyright (C) 1997-2016 by Fran鏾is PIETTE Rue de Grady 24, 4053 Embourg, Belgium ...

Global site tag (gtag.js) - Google Analytics