MUI 页面传值 webview
我们假设a.html 和b.html
a.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> <input type="button" id="bb" value="我是A页面" /> <script > document.getElementById("bb").addEventListener('tap',function () { mui.openWindow( { url:'b.html', extras:{ddd :'dddd1'} }); }); </script> </body> </html>
b 页面代码
<!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(); mui.plusReady(function() { var web = plus.webview.currentWebview(); document.getElementById("ccc").value= web.ddd; }); </script> </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">b页面</h1> </header> <br /> <br /> <br /> <!--<input type="button" id="b" value="b" />--> 值:<input type="text" value="" id="ccc"/> </body> </html>
总结:点击’我是A页面 传值到B页面‘的值ddd.
转载 请注明原文地址并标明转载:http://www.cnblogs.com/laopo
商业用途请与我联系:lcfhn168@163.com