2013-03-26 45 views
1

我在使用notification.alert的phonegap中有警報。它工作正常。我現在想要的是如何在其消息中提供HTML內容。像這樣的東西notification.alert中的Html標記Phonegap

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

因此,當用戶點擊電話號碼我可以撥打該號碼。我試過上面的代碼,它只是將標籤顯示爲文本。請幫忙。

回答

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 
); 
+0

非常感謝@DZL ...我已經實施了你提到的解決方法。 – seshu450 2013-03-28 09:11:51