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]

Popularity: 2%

No Responses to “ShowMsg-在页面上通过JS提示指定消息”

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Website:
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>