PHP快速生成各種信息提示框的方法
更新時間:2016年02月03日 11:24:18 作者:不是JS
這篇文章主要介紹了PHP快速生成各種信息提示框的方法,實例分析了PHP動態(tài)構(gòu)造html與JS頁面元素與調(diào)用顯示的相關(guān)技巧,需要的朋友可以參考下
本文實例講述了PHP快速生成各種信息提示框的方法。分享給大家供大家參考,具體如下:
function ShowMsg($msg, $gourl, $onlymsg = 0, $limittime = 0) //系統(tǒng)提示信息 { /* *$msg 信息提示的內(nèi)容 *$gourl 需要跳轉(zhuǎn)的網(wǎng)址 *$onlymsg 1 表示不自動跳轉(zhuǎn) 0表示自動跳轉(zhuǎn) *$limittime 跳轉(zhuǎn)的時間 */ global $dsql, $cfg_ver_lang; if (eregi ( "^gb", $cfg_ver_lang )) $cfg_ver_lang = 'utf-8'; $htmlhead = "<html>\r\n<head>\r\n<title>系統(tǒng)提示</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$cfg_ver_lang}\" />\r\n"; $htmlhead .= "<base target='_self'/>\r\n</head>\r\n<body leftmargin='0' topmargin='0'>\r\n<center>\r\n<script>\r\n"; $htmlfoot = "</script>\r\n</center>\r\n</body>\r\n</html>\r\n"; if ($limittime == 0) $litime = 5000; else $litime = $limittime; if ($gourl == "-1") { if ($limittime == 0) $litime = 5000; $gourl = "javascript:history.go(-1);"; } if ($gourl == "" || $onlymsg == 1) { $msg = "<script>alert(\"" . str_replace ( "\"", "“", $msg ) . "\");</script>"; } else { $func = " var pgo=0; function JumpUrl(){ if(pgo==0){ location='$gourl'; pgo=1; } }\r\n"; $rmsg = $func; $rmsg .= "document.write(\"<br/><div style='width:400px;padding-top:4px;height:24;font-size:10pt;border-left:1px solid #999999;border-top:1px solid #999999;border-right:1px solid #999999;background-color:#CCC;'>系統(tǒng)提示信息:</div>\");\r\n"; $rmsg .= "document.write(\"<div style='width:400px;height:100;font-size:10pt;border:1px solid #999999;background-color:#f9fcf3'><br/><br/>\");\r\n"; $rmsg .= "document.write(\"" . str_replace ( "\"", "“", $msg ) . "\");\r\n"; $rmsg .= "document.write(\""; if ($onlymsg == 0) { if ($gourl != "javascript:;" && $gourl != "") { $rmsg .= "<br/><br/><a href='" . $gourl . "'>如果你的瀏覽器沒反應(yīng),請點擊這里...</a>"; } $rmsg .= "<br/><br/></div>\");\r\n"; if ($gourl != "javascript:;" && $gourl != "") { $rmsg .= "setTimeout('JumpUrl()',$litime);"; } } else { $rmsg .= "<br/><br/></div>\");\r\n"; } $msg = $htmlhead . $rmsg . $htmlfoot; } if (isset ( $dsql ) && is_object ( $dsql )) @$dsql->Close (); echo $msg; }
更多關(guān)于PHP相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《PHP基本語法入門教程》、《php常用函數(shù)與技巧總結(jié)》及《php面向?qū)ο蟪绦蛟O(shè)計入門教程》
希望本文所述對大家PHP程序設(shè)計有所幫助。
相關(guān)文章
php中filter函數(shù)驗證、過濾用戶輸入的數(shù)據(jù)
PHP 過濾器用于對來自非安全來源的數(shù)據(jù)(比如用戶輸入)進行驗證和過濾,下面為大家整理了一些,需要的朋友可以了解下2014-01-01php下利用curl判斷遠程文件是否存在的實現(xiàn)代碼
php下利用curl判斷遠程文件是否存在的實現(xiàn)代碼,我們有些程序因需要事先判斷文件是否存在然后再進行后面的操作。2011-10-10PHP中使用localhost連接Mysql不成功的解決方法
這篇文章主要介紹了PHP中使用localhost連接Mysql不成功的解決方法,但使用127.0.0.1則沒有問題,本文也可以說是對連接MySQL主機使用127.0.0.1與localhost的區(qū)別的講解,需要的朋友可以參考下2014-08-08php+Mysqli利用事務(wù)處理轉(zhuǎn)賬問題實例
這篇文章主要介紹了php+Mysqli利用事務(wù)處理轉(zhuǎn)賬問題的方法,實例分析了php+mysqli處理事務(wù)的提交與回滾的技巧,需要的朋友可以參考下2015-02-02