jQuery移动电话号码选择
我正在基于Phonegap开发一个新的JQM应用程序 在页面中,我有这样一个链接(工作正常):jQuery移动电话号码选择,jquery,jquery-mobile,cordova,Jquery,Jquery Mobile,Cordova,我正在基于Phonegap开发一个新的JQM应用程序 在页面中,我有这样一个链接(工作正常): 如何添加(可选)另一个电话号码?我希望用户可以选择拨打哪个号码。为什么不使用通知?使用notification.confirm()时,用户将获得一个本机对话框,并可以选择一个选项 以下是一个例子: // process the confirmation dialog result function onConfirm(buttonIndex) { var phone = '01234567
如何添加(可选)另一个电话号码?我希望用户可以选择拨打哪个号码。为什么不使用通知?使用notification.confirm()时,用户将获得一个本机对话框,并可以选择一个选项 以下是一个例子:
// process the confirmation dialog result
function onConfirm(buttonIndex) {
var phone = '0123456789'; // default is an Service Agent
if (2 === buttonIndex) {
phone = '0987654321'; // user want's local dealer
} else if (3 === buttonIndex) {
phone = '911'; // it's really urgent
}
location.href = 'tel:' + phone; // trigger native phonecall
}
// Show a custom confirmation dialog
function showConfirm() {
navigator.notification.confirm(
'Do you like an agent or local dealer?', // message
onConfirm, // callback to invoke with index of button pressed
'Please call us', // title
'Service Agent,Dealer,Emergency' // buttonLabels
);
}
// Trigger the click event
$('#yourButton').click(function(e) {
e.preventDefault();
showConfirm();
});
为什么不使用通知?使用notification.confirm()时,用户将获得一个本机对话框,并可以选择一个选项 以下是一个例子:
// process the confirmation dialog result
function onConfirm(buttonIndex) {
var phone = '0123456789'; // default is an Service Agent
if (2 === buttonIndex) {
phone = '0987654321'; // user want's local dealer
} else if (3 === buttonIndex) {
phone = '911'; // it's really urgent
}
location.href = 'tel:' + phone; // trigger native phonecall
}
// Show a custom confirmation dialog
function showConfirm() {
navigator.notification.confirm(
'Do you like an agent or local dealer?', // message
onConfirm, // callback to invoke with index of button pressed
'Please call us', // title
'Service Agent,Dealer,Emergency' // buttonLabels
);
}
// Trigger the click event
$('#yourButton').click(function(e) {
e.preventDefault();
showConfirm();
});
这将是js部分
这将是js部分你能不能像现在这样添加另一个链接?也许我误解了你的问题。请用var代替no。你能给我举个例子吗?你能不能像现在这样添加另一个链接?也许我误解了你的问题。用var代替no。你能给我举个例子吗;如果我有三个电话号码?(例如一家酒店)每个按钮标签代表一个数字:您有三个按钮,您可以在三个数字之间进行选择;如果我有三个电话号码?(例如一家酒店)每个按钮标签代表一个数字:您有三个按钮,您可以在三个数字之间进行选择。
<html>
<input type="number" id="number" >
<a id="call">Call us free!</a>
</html
var no = $('#number').value;
var call = "tel:+"+no;
$('#call').attr('href', 'call');