[英]box show alert but i want other method like using of if chain or switch or using of for loop or using of map operator
[英]I want to show native alert box for iphone using jquery mobile
我編寫了以下代碼,以使用jQuery mobile + HTML在iPhone上顯示本機警報框。
alert('ID not Match !');
它給了我本機警報,但是我希望能夠更改標題。 請告訴我如何將標題更改/賦予警報框。
這是警報在iOS上的顯示方式:
另請參閱我的自定義對話框。 但是它看起來不像本機警報/對話框:
我的自定義對話框看起來不是本機的。 請幫我。
<div data-role="dialog" id="sure" data-title="Are you sure?">
<div data-role="content">
<h3 class="sure-1">???</h3>
<p class="sure-2">???</p>
<a href="#" class="sure-do" data-role="button" data-theme="b" data-rel="back">Yes</a>
<a href="#" data-role="button" data-theme="c" data-rel="back">No</a>
</div>
</div>
和這個:
function areYouSure(text1, text2, button, callback) {
$("#sure .sure-1").text(text1);
$("#sure .sure-2").text(text2);
$("#sure .sure-do").text(button).on("click.sure", function() {
callback();
$(this).off("click.sure");
});
$.mobile.changePage("#sure");
}
您可以在需要確認對話框的任何地方使用它們:
areYouSure("Are you sure?", "---description---", "Exit", function() {
// user has confirmed, do stuff
});
還可以參考以下內容: http : //dev.jtsage.com/jQM-SimpleDialog/demos2/popup.html
您可以使用phonegap / cordova,這將使您能夠調用navigation.notification.alert
並為您提供本機警報框
您可以在http://docs.phonegap.com/en/2.7.0/cordova_notification_notification.md.html#Notification中找到有關它的更多信息。
出於安全原因,可以這樣處理。 您需要使用自定義對話框。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.