1

我在 phonegap 中有一个使用 notification.alert 的警报。它工作正常。我现在想要的是如何在其消息中提供 HTML 内容。像这样的东西

navigator.notification.alert(
     "Call the Help Desk for assistance at: <a href="#">1(800)309-0136</a>", 
      function() { }, 
     "Having trouble signing in?"
);

这样当用户点击电话号码时,我就可以拨打该号码。我尝试了上面的代码,它只是将标签显示为文本。请帮忙。

4

1 回答 1

0

我认为您不能在通知警报正文中使用 html。

相反,您可以使用navigator.notification.confirm来拨打电话。像这样:

function onConfirm(button) {
    if(button == 'Call') {
        document.location.href = 'tel:1(800)309-0136';  //make the call
    }
}

navigator.notification.confirm(
    'Having trouble signing in?',                                            //title
    'Do you want to call the Help Desk for assistance at 1(800)309-0136?',   //message
     onConfirm,                                                              //callback
    'Call,Exit'                                                              //buttonNames
);
于 2013-03-26T12:19:19.210 回答