基于PHP函数的Msg信息提示框
1.可以设置弹出信息,跳转地址,跳转的时间,跳转的信息标题提示:
2.代码实例:
functionShowMsg($msg, $gourl,$title='',$onlymsg=0, $limittime=0 )
{
if(empty($GLOBALS['cfg_plus_dir'])) $GLOBALS['cfg_plus_dir'] = '..';
$htmlhead = "\r\n
\r\n$title\r\n\r\n";$htmlhead .= "\r\n\r\n
\r\n//默认3秒返回
$litime = ($limittime==0 ? 3000 : $limittime);
$func = '';
if($gourl=='-1')
{
if($limittime==0) $litime = 5000;
$gourl = "javascript:history.go(-1);";
}
if($gourl=='' || $onlymsg==1)
{
$msg = "";
}
else
{
//当网址为:close::objname 时, 关闭父框架的id=objname元素
if(preg_match('/close::/',$gourl))
{
$tgobj = trim(preg_replace('/close::/', '', $gourl));
$gourl = 'javascript:;';
$func .= "window.parent.document.getElementById('{$tgobj}').style.display='none';\r\n";
}
$func .= " var pgo=0;
function JumpUrl(){
if(pgo=0){ location='$gourl'; pgo=1; }
}\r\n";
$rmsg = $func;
$rmsg .= "document.write(\"
$rmsg .= "
$rmsg .= "document.write(\"
\");\r\n";
$rmsg .= "document.write(\"".str_replace("\"","“",$msg)."\");\r\n";
$rmsg .= "document.write(\"";
if($onlymsg==0)
{
if( $gourl != 'javascript:;' && $gourl != '')
{
$rmsg .= "如果你的浏览器没反应,请点击这里...";
$msg .= "
$rmsg .= "setTimeout('JumpUrl()',$litime);";
}
else
{
$rmsg .= "
}
}
else
{
$rmsg .= "