function alert($tip = "", $type = "", $url = "") {
$js = "<script>";
if ($tip)
$js .= "alert('" . $tip . "');";
switch ($type) {
case "close" : //关闭页面
$js .= "window.close();";
break;
case "back" : //返回
$js .= "history.back(-1);";
break;
case "refresh" : //刷新
$js .= "parent.location.reload();";
break;
case "top" : //框架退出
if ($url)
$js .= "top.location.href='" . $url . "';";
break;
case "jump" : //跳转
if ($url)
$js .= "window.location.href='" . $url . "';";
break;
default :
break;
}
$js .= "</script>";
echo $js;
if ($type) {
exit();
}
}
------------------
Alert("警告!","back","");
Alert("警告!","jump","http://baidu.com");