Home Web Front-end H5 Tutorial Clone and delete contacts using phonegap

Clone and delete contacts using phonegap

Mar 26, 2018 pm 03:39 PM
delete Contact person

This time I will bring you the precautions on using phonegap to clone and delete contacts, and use phonegap to clone and delete contacts. The following is a practical case, let’s take a look. one time.

The examples are as follows:

<!DOCTYPE html> 
<html> 
    <head> 
        <meta charset="UTF-8"> 
        <title>Database Example</title> 
        <script type="text/javascript" charset="UTF-8" src="cordova.js"></script> 
        <script type="text/javascript" charset="UTF-8"> 
            document.addEventListener("deviceready", onDeviceReady, false); 
            function onDeviceReady() { 
            } 
              
            function onSuccess(contact){ 
                alert("Success"); 
            } 
              
            function onError(error){ 
                 alert("Error= "+error.code); 
            } 
              
            //克隆联系人 
            function cloneContact(){ 
                var myContact=navigator.contacts.create(); 
                myContact.displayName="张三"; 
                myContact.gender="male"; 
                var myClone=myContact.clone(); 
                myContact.displayName="李四"; 
                myContact.save(onSuccess,onError); 
            }            
            //删除联系人 
            function delContact(){ 
                var myContact=navigator.contacts.create(); 
                myContact.displayName="李四"; 
                myContact.gender="male"; 
                myContact.remove(onSuccess,onFail); 
            }          
        </script> 
    </head> 
    <body> 
        <button onclick="cloneContact();">Clone Contact</button> 
        <button onclick="delContact();">del Contact</button> 
    </body>  
</html>
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the PHP Chinese website !

Recommended reading:

How to use phonegap to find contacts

Summary of common events in phonegap

The above is the detailed content of Clone and delete contacts using phonegap. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Can the inetpub folder be deleted? How to quickly delete the inetpub folder on the C drive Can the inetpub folder be deleted? How to quickly delete the inetpub folder on the C drive Mar 13, 2024 pm 02:00 PM

Can the inetpub folder be deleted? How to quickly delete the inetpub folder on the C drive

How to delete Xiaohongshu notes How to delete Xiaohongshu notes Mar 21, 2024 pm 08:12 PM

How to delete Xiaohongshu notes

What folder is found.000? Can the found.000 folder be deleted? What folder is found.000? Can the found.000 folder be deleted? Mar 13, 2024 pm 08:52 PM

What folder is found.000? Can the found.000 folder be deleted?

Is it true that you can be blocked and deleted on WeChat and permanently unable to be added? Is it true that you can be blocked and deleted on WeChat and permanently unable to be added? Apr 08, 2024 am 11:41 AM

Is it true that you can be blocked and deleted on WeChat and permanently unable to be added?

How to delete Xiaohongshu releases? How to recover after deletion? How to delete Xiaohongshu releases? How to recover after deletion? Mar 21, 2024 pm 05:10 PM

How to delete Xiaohongshu releases? How to recover after deletion?

What is hiberfil.sys file? Can hiberfil.sys be deleted? What is hiberfil.sys file? Can hiberfil.sys be deleted? Mar 15, 2024 am 09:49 AM

What is hiberfil.sys file? Can hiberfil.sys be deleted?

How to completely delete WeChat File Transfer Assistant_Introduction to how to close WeChat File Transfer Assistant How to completely delete WeChat File Transfer Assistant_Introduction to how to close WeChat File Transfer Assistant Mar 20, 2024 pm 08:31 PM

How to completely delete WeChat File Transfer Assistant_Introduction to how to close WeChat File Transfer Assistant

How to send files to others on TikTok? How to delete files sent to others? How to send files to others on TikTok? How to delete files sent to others? Mar 22, 2024 am 08:30 AM

How to send files to others on TikTok? How to delete files sent to others?

See all articles