---index.html
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> <title></title> <script src="js/mui.min.js"></script> <link href="css/mui.min.css" rel="stylesheet" /> <script type="text/javascript" charset="utf-8"> mui.init(); </script> </head> <body><div class="mui-content"> <button type="button" onclick="tel();">打电话</button> </div> <nav class="mui-bar mui-bar-tab"> <a class="mui-tab-item mui-active"> <span class="mui-icon mui-icon-home"></span> <span class="mui-tab-label">首页</span> </a> <a class="mui-tab-item" id="tab2"><!--绑定单击跳转事件不能用这个onclick="openTel();"--> <span class="mui-icon mui-icon-phone"></span> <span class="mui-tab-label">电话</span> </a> <a class="mui-tab-item"> <span class="mui-icon mui-icon-email"></span> <span class="mui-tab-label">邮件</span> </a> <a class="mui-tab-item"> <span class="mui-icon mui-icon-gear"></span> <span class="mui-tab-label">设置</span> </a> </nav> <script type="text/javascript"> /*判断h5+插件是否加载完毕*/ mui.plusReady(function(){ document.getElementById('tab2').addEventListener('tap',function(){ mui.openWindow({ url : 'tel.html', id : 'tel.html' }); }); }); function tel(){ mui.openWindow({ url:"tel.html", id:"tel.html", extras:{name:'小明',age:18}/*传递参数*/ }); } </script> </body> </html>
--tel.html子页面接受数据
<!doctype html> <html> <head> <meta charset="UTF-8"> <title></title> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> <link href="css/mui.min.css" rel="stylesheet" /> </head> <body> <header class="mui-bar mui-bar-nav"> <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a> <h1 class="mui-title">拨打电话</h1> </header> <div class="mui-content"> 187306308888<br /> 姓名:<span id="name"></span> 年龄:<span id="age"></span> </div> <script src="js/mui.min.js"></script> <script type="text/javascript"> mui.init(); /*加载获取传递过来的数据*/ mui.plusReady(function(){ /*获取对象*/ var sData = plus.webview.currentWebview(); var name = mui('#name'); name[0].innerHTML = sData.name; var age = mui('#age'); age[0].innerHTML = sData.age; }); </script> </body> </html>