PHP快速生成各种信息提示框的方法
本文实例讲述了PHP快速生成各种信息提示框的方法。分享给大家供大家参考,具体如下:
functionShowMsg($msg,$gourl,$onlymsg=0,$limittime=0)//系统提示信息
{
/*
*$msg信息提示的内容
*$gourl需要跳转的网址
*$onlymsg1表示不自动跳转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<metahttp-equiv=\"Content-Type\"content=\"text/html;charset={$cfg_ver_lang}\"/>\r\n";
$htmlhead.="<basetarget='_self'/>\r\n</head>\r\n<bodyleftmargin='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="varpgo=0;
functionJumpUrl(){
if(pgo==0){location='$gourl';pgo=1;}
}\r\n";
$rmsg=$func;
$rmsg.="document.write(\"<br/><divstyle='width:400px;padding-top:4px;height:24;font-size:10pt;border-left:1pxsolid#999999;border-top:1pxsolid#999999;border-right:1pxsolid#999999;background-color:#CCC;'>系统提示信息:</div>\");\r\n";
$rmsg.="document.write(\"<divstyle='width:400px;height:100;font-size:10pt;border:1pxsolid#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/><ahref='".$gourl."'>如果你的浏览器没反应,请点击这里...</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;
}
更多关于PHP相关内容感兴趣的读者可查看本站专题:《PHP基本语法入门教程》、《php常用函数与技巧总结》及《php面向对象程序设计入门教程》
希望本文所述对大家PHP程序设计有所帮助。