search
HomeWeb Front-endH5 TutorialIntroduction to how to use phonegap (1) Find contacts

The following editor will bring you an implementation method of using phonegap to find contacts. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor and take a look.

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(contacts){ 
                document.write(contacts.length+&#39;contacts found.&#39;); 
                for(var i=0;i<contacts.length;i++){ 
                    for(var j=0;j<contacts[i].emails.length;j++){ 
                        document.write("Email="+contacts[i].emails[j].email); 
                    } 
                } 
                alert(&#39;success&#39;); 
            } 
              
            function onError(error){ 
                 alert("Ooops!"); 
            } 
              
            function findContact(){ 
                var myOptions=new ContactFindOptions(); 
                myOptions.filter="gmail";//过滤 
                var myFields=["emails"];//要查询的字段 
                navigator.contacts.find(myFields,onSuccess,onError,myOptions); 
            } 
              
        </script> 
    </head> 
  
    <body> 
        <button onclick="findContact();">Find Contact</button> 
    </body> 
  
</html>

The above is the detailed content of Introduction to how to use phonegap (1) Find contacts. For more information, please follow other related articles on the PHP Chinese website!

Statement
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
h5是指什么h5是指什么Aug 02, 2023 pm 01:52 PM

H5是指HTML5,是HTML的最新版本,H5是一个功能强大的标记语言,为开发者提供了更多的选择和创造空间,它的出现推动了Web技术的发展,使得网页的交互和效果更加出色,随着H5技术的逐渐成熟和普及,相信它将会在互联网的世界中发挥越来越重要的作用。

如何区分H5,WEB前端,大前端,WEB全栈?如何区分H5,WEB前端,大前端,WEB全栈?Aug 03, 2022 pm 04:00 PM

本文带你快速区分H5、WEB前端、大前端、WEB全栈,希望对需要的朋友有所帮助!

h5如何使用positionh5如何使用positionDec 26, 2023 pm 01:39 PM

在H5中使用position属性可以通过CSS来控制元素的定位方式:1、相对定位relative,语法为“style="position: relative;”;2、绝对定位absolute,语法为“style="position: absolute;”;3、固定定位fixed,语法为“style="position: fixed;”等等。

h5怎么实现web端向上滑动加载下一页h5怎么实现web端向上滑动加载下一页Mar 11, 2024 am 10:26 AM

实现步骤:1、监听页面的滚动事件;2、判断滚动到页面底部;3、加载下一页数据;4、更新页面滚动位置即可。

总结介绍H5新晋级标签(附示例)总结介绍H5新晋级标签(附示例)Aug 03, 2022 pm 05:10 PM

​本文给大家整理介绍H5新晋级标签有哪些,希望对需要的朋友有所帮助!

vue3怎么实现H5表单验证组件vue3怎么实现H5表单验证组件Jun 03, 2023 pm 02:09 PM

效果图描述基于vue.js,不依赖其他插件或库实现;基础功能使用保持和element-ui一致,内部实现做了一些移动端差异的调整。当前构建平台使用uni-app官方脚手架构建,因为当下移动端大多情况就h6和微信小程序两种,所以一套代码跑多端十分适合技术选型。实现思路核心api:使用provide和inject,对应和。在组件中,内部用一个变量(数组)去将所有实例储存起来,同时把要传递的数据通过provide暴露出去;组件则在内部用inject去接收父组件提供过来的数据,最后把自身的属性和方法提交

页面h5和php是什么意思?(相关知识探讨)页面h5和php是什么意思?(相关知识探讨)Mar 20, 2023 pm 02:23 PM

HTML5和PHP是Web开发中常用的两种技术,前者用于构建页面布局、样式和交互,后者用于处理服务器端的业务逻辑和数据存储。下面我们来深入探讨HTML5和PHP的相关知识。

h5有哪些缓存机制h5有哪些缓存机制Nov 16, 2023 pm 01:27 PM

H5没有直接的缓存机制,但是通过结合使用Web Storage API、IndexedDB、Service Workers、Cache API和Application Cache等技术,可以实现强大的缓存功能,提高应用程序的性能、可用性和可扩展性,这些缓存机制可以根据不同的需求和应用场景进行选择和使用。详细介绍:1、Web Storage API是H5提供的一种简单等等。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)