a 页面 跳转到b页面 再从 b页面返回a 页面时把参数 返回回来给a页面 并执行 a页面 写好的 方法如图
a.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link href="../../css/mui.min.css" rel="stylesheet" />
<script src="../../../js/mui.min.js"></script>
<script src="../../../js/jquery.js"></script>
<script>
mui.init()
function plusReady(){
mui("body").on("tap",".jump",function(){
mui.openWindow({
url:"b.html",
id:"b"
})
})
}
if(window.plus){
plusReady();
}else{
document.addEventListener("plusready",plusReady,false);
}
//返回回来要执行的方法
function fun1(e){
var val=e.detail.inputVal
$(".a1 font").html(val)
}
//自定义窗体事件 doit 要和b页面定义的 事件名称一致
window.addEventListener('doit',fun1);
</script>
</head>
<body>
<a href="javascript:void(0);" class="jump">跳转到B页面</a>
<div class="a1">返回回来的值是------<font style=" font-size:20px;color:#2AC845"></font></div>
<div style=" font-size:50px ; text-align: center; display: block; margin: 50px 0 0 0;">a.html页面</div>
</body>
</html>
b.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link href="../../css/mui.min.css" rel="stylesheet" />
<script src="../../../js/mui.min.js"></script>
<script src="../../../js/jquery.js"></script>
<script>
mui.init()
if(window.plus){
plusReady();
}else{
document.addEventListener("plusready",plusReady,false);
}
function plusReady(){
mui("body").on("tap",".jump",function(){
var view=plus.webview.getWebviewById("HBuilder");//注意 HBuilder是上个页面的ID你自己要替换掉
mui.fire(view,'doit',{
inputVal:$("#text").val()
});
mui.back()
})
}
</script>
</head>
<body>
<input type="text" id="text">
<a href="javascript:void(0)" class="jump">返回</a>
<div style=" font-size:50px ; text-align: center; display: block; margin: 50px 0 0 0;">b.html页面</div>
</body>
</html>