代码收藏

收集网站开发时常用到的代码(asp,php,js等)

« thumb-创建图片缩略图php文本采集类 »

ShowMsg-在页面上通过JS提示指定消息

   /*
    *     功能:在页面上通过JS提示指定消息,并结束页面执行
    *     参数:
    *         Msg         :待显示的消息
    *         URL         :需指定返回的页面,不指定时返回前一页
    *     作者:itlearner
    */

    function ShowMsg($Msg, $URL = "")
    {
        //header('Content-Type: text/html; charset=utf-8');
        //echo '<meta http-equiv="Content-Type" content="text/html; charset=gbk" />';
        echo "<script type=\"text/javascript\">";
        if (strlen($Msg) > 1)
            echo "alert(\"$Msg\");";
        if ($URL == "")
            echo "history.go(-1);";
        else
            echo "document.location.href=$URL;";
        echo "</script>";

        exit();
  }[CODE_LITE]

[/CODE_LITE]

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

最新评论及回复

最近发表

Powered By Z-Blog 1.8 Spirit Build 80605

Copyright 2008 ITlearner. Some Rights Reserved.