HTML
  Home arrow HTML arrow Page 4 - Uses of the New Window Command for Web Sit...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

Uses of the New Window Command for Web Sites
By: Stephen Davies
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 2
    2008-02-26

    Table of Contents:
  • Uses of the New Window Command for Web Sites
  • Approaches to opening a link in a new window
  • BASE tag
  • Examples of common new window uses
  • Advanced Usage

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Uses of the New Window Command for Web Sites - Examples of common new window uses


    (Page 4 of 5 )

    Take a look at the code below for the file test.html:


    test.html


    <html>

    <head>

    <title>Uses of the New Window command demonstration</title>

    <script type="text/javascript">

    function testOpen() {

    window.open('http://www.amazon.com/','_blank');

    }

    </script>

    </head>

    <body>

    <h1>window.open() demo</h1>

    <a href="#" onclick="testOpen();">go to Amazon</a>

    </body>

    </html>


    Picture 4: window.open() demonstration 1


    Look at the screenshot. When you click the link, a new common window is opened.

    As you saw in the <a href="#" onclick="testOpen();">go to Amazon</a> link, we did not specify the target URL in the href attribute, but added an onclick attribute. A literal JavaScript string is declared as the event handler. When the user clicks the link, the CLICK event is fired and the content in the onclick attribute will be evaluated, so the testOpen() function is invoked. In the testOpen() function, it uses the window.open() to open http://www.amazon.com/ in a new blank window.

    b) Open a customized window

    You can add some feature options using the open() method.


    window.open('http://www.amazon.com', '_blank', 'width=200, height=200,
    menubar=no, toolbar=no, location=no, scrollbars=no, status=no, resizable=no');


    Picture 5: window.open() demonstration with customized new window

    When you click the link, a new 200*200 window will be opened without the menu bar, toolbar, location, scrollbars, and status bar. And the window size is unchangeable. It sounds cool, right? Try it.

    More HTML Articles
    More By Stephen Davies


       · open new windows is in most cases - from the user's point of view - a bad idea:*...
     

    HTML ARTICLES

    - Comparing Browser Response to Active Client ...
    - Testing Browser Response to Active Client Pa...
    - Active Client Pages: Completing the Code for...
    - ACP and Browsers: Setting up an Example
    - How Browsers Respond to Active Client Pages
    - Completing a Tree with Active Client Pages
    - HTML Form Verification and ACP
    - Building an ACP Tree
    - Completing an ACP 3D HTML Table Image Gallery
    - Building an ACP 3D HTML Table Image Gallery
    - A Multiple Page Image Gallery with Active Cl...
    - Building an Image Gallery with Active Client...
    - Concluding a Menu for All Browsers
    - A Vertical Menu for All Browsers
    - Downloading Long HTML Pages with ACP







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    Stay green...Green IT