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加载 –