This article mainly introduces PHP implementation similar to JS in the alert () prompt box function, very practical, here is recommended to everyone, there is a need for small partners to reference, I hope you can like.
Mainly used to add judgment hints, jumps, returns, refreshes.
The code is as follows:
/** * js prompt jump * @param $tip pop-up window prompt information (no prompt for null) * @param $type set Type close = Off, back= return , refresh= prompt reload, jump hint and skip URL * @param $url jump URL */function alert ($tip = "", $type = "", $url = "") {$js = "<scrip T> "; if ($tip) $js. = "alert ('". $tip. "');"; Switch ($type) {case "close"://Closes the page $js. = "Window.close ();"; Break Case ' back '://return $JS. = "History.back (-1);"; Break Case "Refresh"://Refresh $js. = "Parent.location.reload ();"; Break Case "Top"://Frame exits if ($url) $js. = "top.location.href=". $url. "';"; Break Case "jumping"://Jump if ($url) $js. = "window.location.href=". $url. "';"; Break Default:break; } $js. = "</script>"; Echo $js; if ($type) {exit (); }}
Summary : The above is the entire content of this article, I hope to be able to help you learn.