#p1、#p2、#p3のマルチページフォームがあります。フォームを送信したら、ブラウザのボタンに戻るをクリックしようとすると、フォームフィールドが空の状態で#p1に移動するはずです。Jquery Mobileで可能ですか?
2520 次
1 に答える
2
私は戻るボタンを上書きして、どのページがアクティブなページであるかを確認し、そのページに基づいて必要なハウスクリーニングを行います...
私はこれに本当に似た別の質問に例を提出しました:
オプション、ポップアップ、ホームページがある場合は、P3が必要な場合があり、activePageがP3と等しい場合は、フォームをクリアしてP1を表示します。
function pageinit() {
document.addEventListener("deviceready", deviceInfo, true);
}
function deviceInfo() {
document.addEventListener("backbutton", onBackButton, true);
}
function onBackButton(e) {
try{
var activePage = $.mobile.activePage.attr('id');
if(activePage == 'P3'){
clearForm(); // <-- Calls your function to clear the form...
window.location.href='index.html#P1';
} else if(activePage == 'P1'){
function checkButtonSelection(iValue){
if (iValue == 2){
navigator.app.exitApp();
}
}
e.preventDefault();
navigator.notification.confirm(
"Are you sure you want to EXIT the program?",
checkButtonSelection,
'EXIT APP:',
'Cancel,OK');
} else {
navigator.app.backHistory();
}
} catch(e){ console.log('Exception: '+e,3); }
}
于 2012-09-24T18:18:36.043 に答える