gpt4 book ai didi

javascript - 如何在 Phonegap 中调用解析号码?

转载 作者:行者123 更新时间:2023-11-29 01:08:22 25 4
gpt4 key购买 nike

这是HTML文件

 <div class="email">
<p style ="top:0;"><b id="email"></b</p>
<a href="https://accounts.google.com" style="top:10px;">
<img class="imgleft" src="css/gmail.png" style="height:30px;"/></a>

<p style ="top:30px; color:#45b3e0;"><b id="phone"></b></p>
<a href="#" onclick ='return phoneNumber()'style="top:45px;">
<img class="imgleft" src="css/phone.png" style="height:20px;"/></a>
</div>

这是JS文件

function getInformation(){

var address,companyEmail,companyName,companyPhone,followupDate,leadDate,leadDetails,leadValue,contactPerson,followupAction,status;

address=localStorage.getItem("Address");
companyEmail=localStorage.getItem("companyemail");
companyName=localStorage.getItem("companyname");
companyPhone=localStorage.getItem("companyphone");
followupDate=localStorage.getItem("followupdate");
leadDate=localStorage.getItem("leaddate");
leadDetails=localStorage.getItem("leaddetails");
leadValue=localStorage.getItem("leadvalue");
contactPerson=localStorage.getItem("contactperson");
followupAction=localStorage.getItem("followupaction");
status=localStorage.getItem("Status");

//document.getElementById("description").innerHTML=Address;
document.getElementById("email").innerHTML=companyEmail;
document.getElementById("cname").innerHTML=companyName;
document.getElementById("phone").innerHTML=companyPhone;
document.getElementById("fdate").innerHTML=followupDate;
document.getElementById("Address").innerHTML=address;
document.getElementById("ldetail").innerHTML=leadDetails;
document.getElementById("lvalue").innerHTML=leadValue;
document.getElementById("name").innerHTML=contactPerson;
document.getElementById("faction").innerHTML=followupAction;
document.getElementById("status").innerHTML=status; }
function phoneNumber(phone)
{

phone = Phone.replace(/[^0-9]/g, "");
window.location = "tel:" + phone;
}

我正在为 Android 和 IOS 开发 Phone Gap 应用程序,在这里我能够从服务器解析电话号码和邮件 ID 但我的问题1. 当用户点击调用图像时解析的号码应该拨号和邮件一样吗?

最佳答案

修改html代码如下

<div class="email">
<p style ="top:0;"><b id="email"></b</p>
<a href="mailto:test@gmail.com" style="top:10px;">
<img class="imgleft" src="css/gmail.png" style="height:30px;"/></a>

<p style ="top:30px; color:#45b3e0;"><b id="phone"></b></p>
<a href="tel:+910000000000"> +91 00000 00000 style="top:45px;">
<img class="imgleft" src="css/phone.png" style="height:20px;"/></a>
</div>

然后在你的 config.xml 文件中添加以下内容

<access launch-external="yes" origin="mailto:*" />
<access launch-external="yes" origin="tel:*" />

它将打开本地邮件系统和本地拨号器来调用电话。

关于javascript - 如何在 Phonegap 中调用解析号码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36077112/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com