PHP+JS的信息提示弹窗

基于PHP函数的Msg信息提示框

1.可以设置弹出信息,跳转地址,跳转的时间,跳转的信息标题提示:

2.代码实例:

<?php

function ShowMsg($msg, $gourl,$title='',$onlymsg=0, $limittime=0 )

{

if(empty($GLOBALS['cfg_plus_dir'])) $GLOBALS['cfg_plus_dir'] = '..';

$htmlhead = "<html>\r\n<head>\r\n<title>$title</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n";

$htmlhead .= "<base target='_self'/>\r\n<style>div{line-height:160%;}</style></head>\r\n<body leftmargin='0' topmargin='0' bgcolor='#FFFFFF'>\r\n<center>\r\n<script>\r\n";

$htmlfoot = "</script>\r\n</center>\r\n</body>\r\n</html>\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 = "<script>alert(\"".str_replace("\"","“",$msg)."\");</script>";

}

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(\"<br /><div style='width:400px;padding:0px;border:1px solid #DADADA;'>";

$rmsg .= "<div style='padding:6px;color:#ffffff;font-size:14px;border-bottom:1px solid #DADADA;background:#72BF01 url({$GLOBALS['cfg_plus_dir']}/img/wbg.gif)';'><b>$title</b></div>\");\r\n";

$rmsg .= "document.write(\"<div style='height:130px;font-size:10pt;background:#fff'><br />\");\r\n";

$rmsg .= "document.write(\"".str_replace("\"","“",$msg)."\");\r\n";

$rmsg .= "document.write(\"";

 

if($onlymsg==0)

{

if( $gourl != 'javascript:;' && $gourl != '')

{

$rmsg .= "<br /><a href='{$gourl}'>如果你的浏览器没反应,请点击这里...</a>";

$rmsg .= "<br/></div>\");\r\n";

$rmsg .= "setTimeout('JumpUrl()',$litime);";

}

else

{

$rmsg .= "<br/></div>\");\r\n";

}

}

else

{

$rmsg .= "<br/><br/></div>\");\r\n";

}

$msg = $htmlhead.$rmsg.$htmlfoot;

}

echo $msg;

}

//ShowMsg('对不起,你的信息不完整的啊!', 'time.php',$title='CMS内容管理系统提示');

?>

  

实例所显示的参数是必须要填写的内容项,除此之外还可以添加其他的内容目内容,来自于织梦程序

转载于:https://www.cnblogs.com/jyb2014/p/3922110.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值