What is the code to have a popup box come up when someone presses a link?

Terry Clark April 13, 2011
Pinterest Stumbleupon Whatsapp

I need to insert some code so that when a person clicks on a link a popup box appears to say “you are leaving this website”. Can anybody direct me to the line of code I need and the process.

  1. Tina
    April 17, 2011 at 11:19 pm

    Terry,

    did any of the code above work for you? Please let us know in case you need more help. Thank you!

  2. James Bruce
    April 15, 2011 at 7:14 am

    Ill add that since you asked about a LINK specifically, just use the above code, but instead of add it to your tag. so something like this:

    Link text

  3. joey jimbob
    April 14, 2011 at 8:25 pm

    This can be achieved without forms pretty easily:

    function popup()
    {
    alert("Hello! am a popup!");
    }

    link or img here

  4. OnlineTechtips.info
    April 14, 2011 at 10:00 am

    to use link instead of button, use a href tag instead of input tags.

  5. OnlineTechtips.info
    April 14, 2011 at 9:58 am

    To create a pop up window:

    CLICK ME!

    To create an alert box:

    function show_alert()
    {
    alert("Hello! I am an alert box!");
    }