2
下一個頁面提交這是我的HTML第一頁中,我們將填補細節在形式當我去到的數據是不是來
<div data-role="content">
<div data-role="fieldcontain">
<label for="name1">Name</label>
<input name="name1" id="name1" value="" type="text">
</div>
<div data-role="fieldcontain">
<label for="age">Age</label>
<input name="age" id="age" value="" type="text">
</div>
<div data-role="fieldcontain">
<label for="address">Address</label>
<input name="address" id="address" value="" type="text">
</div>
<div data-role="fieldcontain">
<label for="mobile">Mobile</label>
<input name="mobilet" id="mobile" value="" type="text">
</div>
<div data-role="button" data-theme="b" data-inline="true" id="button">Submit</div>
</div>
下面是第二頁,在此我們將展示填充的數據,將會給出一個編輯按鈕,這將再次將用戶帶到第一頁。
<div data-role="content" id="content2">
<form id="form1">
<div data-role="fieldcontain">
<label for="name">Name</label>
<span class="field" style="padding:350px;" id="un"></span>
</div>
<div data-role="fieldcontain">
<label for="age">age</label>
<span class="field1" style="padding:350px;" id="pw"></span>
</div>
<div data-role="fieldcontain">
<label for="address">Address</label>
<span class="field2" style="padding:350px;" id="au"></span>
</div>
<div data-role="fieldcontain">
<label for="mobile">Mobile</label>
<span class="field3" style="padding:350px;" id="fr"></span>
</div>
<div style="text-align:center;">
<div data-role="button" data-theme="b" data-inline="true" id="button2">Edit</div>
</div>
</form>
</div>
jQuery中: -
$(document).unbind('pageinit').bind('pageinit', function() {
$("#button1").click(function() {
callConnection();
});
$("#button2").click(function() {
callEditConnection();
});
});
function callConnection(){
localStorage.setItem("user", $("#name1").val());
localStorage.setItem("pass", $("#age").val());
$.mobile.changePage("#page2");
}
function callEditConnection(){
$("#un").val(localStorage.getItem("user"));
$("#pw").val(localStorage.getItem("pass"));
$.mobile.changePage("#page1");
}
請幫我找出這個問題是我的代碼,第2頁第1頁的值是不是來
當加載第2頁,我沒有看到傳遞給頁2.嘗試設置字段值的任何數據時,2頁中JavaScript加載 –