Sunday, May 1, 2011

How to open another window

Hi , how can i open a page in new window in using javascript.

From stackoverflow
  • window.open

  • Try with this piece of code:

    window.open("http://www.google.com");
    

    That's if you want to open a new window.

    Good luck.

  • You can use this:

    <script language="javascript" type="text/javascript">
    <!--
    function popitup(url) {
        newwindow=window.open(url,'name','height=200,width=150');
        if (window.focus) {newwindow.focus()}
        return false;
    }
    
    // -->
    </script>
    

    You can call it like this:

    <a href="something.html" onclick="return popitup('something.html')">Link to popup</a>
    
  • Refer to http://www.javascript-coder.com/window-popup/javascript-window-open.phtml

    You can attach the code as a client-side event on a button.

  • or you can use plain old html and the target attribute. <a href="link.html" target="_blank">

0 comments:

Post a Comment