JS--封装JS跳转页面函数

//JS跳转页面
function gourl($iAlert,$iPage,$history='',$target="window")
{
    if ($iAlert != "") {
        echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
        echo '<script language="javascript">alert("'.$iAlert.'")</script>';
    }
    if ($iPage != "") {
        echo '<script language="javascript">'.$target.'.location.href = "'.$iPage.'";</script>';
        exit;
    }
    if ($history != "") {
        echo '<script language="javascript">history.go('.$history.');</script>';
        exit;
    }
}

猜你喜欢

转载自www.cnblogs.com/mrszhou/p/9036938.html