• Archives

  • How to create a pop up window tutorial

    By admin | December 29, 2007

    OK guys here is the tutorial which many of you want how to create a pop up window which you must have seen in many of the wbesites

    First of all create a simple html file:

    <html>

    <head>

    </head>

    <body>

    </body>

    </html>

    Done

    Now add the add the following code below head tag

    <script language=”JavaScript”>
    <!–
    function popup(url,windowtitle,specification) {

    window.open(url,windowtitle,specification);
    }
    //–>

    </script>

    The above function will first tell the browser to read the below lines as JavaScript code

    If your browser is old this code <!– will tell the browser to read it is as comment and perform no action

    Then you will create a function popup

    With three arguments url,windowtitle,specification

    Done

    Now below <body> add following code

    <a href=”javascript:;”onClick=”popup(‘http://www.yahoo.com’,’Yahoo’,’width=540,height=480′)”>Click me </a>

    Done

    <html>
    <head>
    <script language=”JavaScript”>
    <!–
    function popup(url,windowtitle,specification) {
    window.open(url,windowtitle,specification);
    }
    //–>
    </script>
    </head>
    <body>
    <a href=”javascript:;”onClick=”popup(‘http://www.yahoo.com’,’Yahoo’,’width=540,height=480′)”>Click me </a>
    </body>
    </html>

    For example click below





    Click me

    Thanks
    krates

    Topics: Javascript | Comments Off on How to create a pop up window tutorial

    Related Links: