我们在进行表单操作时,有时为了友好需要提示用户操作结果,并跳转到相关页面,请看以下函数:
1 function message( $msgTitle , $message , $jumpUrl ){
2 $str = '<!DOCTYPE HTML>' ;
3 $str .= '<html>' ;
4 $str .= '<head>' ;
5 $str .= '<meta charset="utf-8">' ;
6 $str .= '<title>页面提示</title>' ;
7 $str .= '<style type="text/css">' ;
8 $str .= ' *{margin:0; padding:0}a{color:#369; text-decoration:none;}a:hover{text-decoration:underline}body{height:100%; font:12px/18px Tahoma, Arial, sans-serif; color:#424242; background:#fff}.message{width:450px; height:120px;
9 margin:16% auto; border:1px solid #99b1c4; background:#ecf7fb}.message h3{height:28px;
10 line-height:28px; background:#2c91c6; text-align:center; color:#fff; font-size:14px}.msg_txt{padding:10px; margin-top:8px}.msg_txt h4{line-height:26px; font-size:14px}.msg_txt h4.red{color:#f30}.msg_txt p{line-height:22px}' ;
11 $str .= '</style>' ;
12 $str .= '</head>' ;
13 $str .= '<body>' ;
14 $str .= '<div>' ;
15 $str .= '<h3>'. $msgTitle .'</h3>' ;
16 $str .= '<div>' ;
17 $str .= '<h4>'. $message .'</h4>' ;
18 $str .= '<p>系统将在 <span style="color:blue;font-weight:bold">3</span> 秒后自动跳转,如果不想等待,直接点击 <a href="{$jumpUrl}">这里</a> 跳转</p>' ;
19 $str .= "<script>setTimeout('location.replace(\'". $jumpUrl ."\')',2000)</script>" ;
20 $str .= '</div>' ;
21 $str .= '</div>' ;
22 $str .= '</body>' ;
23 $str .= '</html>' ;
24 echo $str ;
25 }
26
27 // 使用方法如下
28
29 message('操作提示','操作成功!','http://HdhCmsTesthelloweba测试数据/');
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did29799