首頁 php教程 PHP源码 信息提示函数

信息提示函数

May 25, 2016 pm 05:15 PM

php代码

function ShowMsg($msg, $gourl, $onlymsg = 0, $limittime = 0) //系统提示信息
{
/*
*$msg 信息提示的内容
*$gourl 需要跳转的网址
*$onlymsg 1 表示不自动跳转 0表示自动跳转
*$limittime 跳转的时间
*/
	global $dsql, $cfg_ver_lang;
	if (eregi ( "^gb", $cfg_ver_lang ))
		$cfg_ver_lang = 'utf-8';
	$htmlhead = "<html>\r\n<head>\r\n<title>系统提示</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/><p 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;'>系统提示信息:</p>\");\r\n";
		$rmsg .= "document.write(\"<p 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 . "'>如果你的浏览器没反应,请点击这里...</a>";
			}
			$rmsg .= "<br/><br/></p>\");\r\n";
			if ($gourl != "javascript:;" && $gourl != "") {
				$rmsg .= "setTimeout('JumpUrl()',$litime);";
			}
		} else {
			$rmsg .= "<br/><br/></p>\");\r\n";
		}
		$msg = $htmlhead . $rmsg . $htmlfoot;
	}
	if (isset ( $dsql ) && is_object ( $dsql ))
		@$dsql->Close ();
	echo $msg;
}
登入後複製
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱門文章

倉庫:如何復興隊友
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
兩個點博物館:所有展覽以及在哪裡可以找到它們
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱門文章

倉庫:如何復興隊友
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
兩個點博物館:所有展覽以及在哪裡可以找到它們
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱門文章標籤

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)