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.

 

posted @ 2015-12-29 17:16  每天进步一点点!  阅读(4888)  评论(1编辑  收藏  举报