提示是项目中最常用到的。一般有弹窗,页面两种大类型。
下面是一个万能提示页面。具体需求,可以具体定制。
<!doctype html> <html> <head> <meta charset="utf-8"> <title></title> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, minimal-ui" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <meta name="format-detection"content="telephone=no, email=no" /> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, minimal-ui" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-status-bar-style" content="black" /> <meta name="format-detection" content="telphone=no, email=no" /> <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"> <meta name="apple-mobile-web-app-capable" content="yes" /> <link href="/Public/Partner/weixin/css/style.css" type="text/css" rel="stylesheet" /> <link href="http://netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet"> <script src="/Public/Partner/weixin/js/jquery-1.9.1.min.js" type="text/javascript"></script> </head> <script> function closeWeiBrowser(){ wx.closeWindow(); } </script> <body> <div id="wrap"> <!--content start--> <div class="content"> <div class="perfect-info"> <div class="perfect-info-cont"> <div class="alert-font"> <h1>{$alert}</h1> </div> <div class="alert-info-btn"> <?php $urlConfig = array( 'order'=>array('url'=>'/partner.php/Home/User/order.html','btnv'=>'我的订单'), 'editinfo'=>array('url'=>'/partner.php/Home/User/viewInfo.html','btnv'=>'确认提交'), 'sendmesg'=>array('url'=>'/partner.php/Home/User/systemInfo.html','btnv'=>'确认') ); $arr = $urlConfig[$_GET['config']]; if($_GET['reffer']){ echo '<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js" type="text/javascript"></script>'; echo '<input type="button" onclick = "closeWeiBrowser()" class = "closeweb" value="关闭" />'; }else{ echo '<a href = "'.$arr['url'].'" style="display:block;text-align: center;line-height: 43px">'.$arr['btnv'].'</a>'; } ?> </div> </div> </div> </div> <!--content end--> </div> </body> </html>
我这里主要是定制了,提示语,跳转URL 和跳转按钮的文字。由于提示语可能存在各种环境中,所以我选择了,页面跳转时候,带在地址栏,配置进来反而不方便。
JS 万能删除提示
$(function(){ //公共提示删除框 $('.confirm_bin').click(function(){ var r=confirm("确定删除此项?") if (r==true) { window.location.href = $(this).attr('href'); }else{ return false; } }) })
页面上a标签只要 class = "cinfirm_bin"就好了。
onkeyup="if(/D/.test(this.value)){this.value='';}"