PHP implementation is similar to the alert () prompt box in js, jsalert_PHP tutorial

Source: Internet
Author: User
PHP implementation is similar to the alert () prompt box in js, jsalert. PHP implementation is similar to the alert () prompt box in js. jsalert is mainly used to add judgment prompts, jump, return, and refresh. The code for copying the code is as follows: *** JS prompt jump * @ param $ tip pop-up window PHP implementation is similar to the alert () prompt box in js, jsalert

It is mainly used to add judgment prompts, jump, return, and refresh.

The code is as follows:
/**
* JS prompt jump
* @ Param $ tip prompt message in the pop-up window (blank, no prompt)
* @ Param $ type the setting type is close = close, back = return, refresh = prompting for heavy load, jump prompting and jump to url
* @ Param $ url jump url
*/
Function alert ($ tip = "", $ type = "", $ url = ""){
$ Js = "script";
If ($ tip)
$ Js. = "alert ('". $ tip ."');";
Switch ($ type ){
Case "close": // close the page
$ Js. = "window. close ();";
Break;
Case "back": // return
$ Js. = "history. back (-1 );";
Break;
Case "refresh": // refresh
$ Js. = "parent. location. reload ();";
Break;
Case "top": // exit the framework
If ($ url)
$ Js. = "top. location. href = '". $ url ."';";
Break;
Case "jump": // jump
If ($ url)
$ Js. = "window. location. href = '". $ url ."';";
Break;
Default:
Break;
}
$ Js. = "script";
Echo $ js;
If ($ type ){
Exit ();
}
}

The above is all the content of this article. I hope it will help you learn php.

Http://www.bkjia.com/PHPjc/969491.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/969491.htmlTechArticlePHP implementation similar to js in the alert () prompt box, jsalert is mainly used to add judgment prompt, jump, return, refresh. The code is as follows:/*** JS prompts jump * @ param $ tip to pop up the window...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.