JavaScript
  Home arrow JavaScript arrow Page 3 - Methods of the DOM Location Object
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? 
JAVASCRIPT

Methods of the DOM Location Object
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-12-08

    Table of Contents:
  • Methods of the DOM Location Object
  • Assign() Gives You Tasks
  • The Jatrix…Reloaded()
  • Replace()

  • 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


    Methods of the DOM Location Object - The Jatrix…Reloaded()


    (Page 3 of 4 )

    I have to confess that when I was coding this next example I decided to see if I could make it super annoying, and sure enough, I could. Reload() is used to reload the current document or page. That being said, you might want to avoid using it with document.write, as I do in this next example. Granted, it's easy enough to get out of the situation (just press control + alt + delete and close your browser window). Behold…Annoying Page 2000:


    <html>

    <head>

    <script type="text/javascript">


    document.write(window.location.reload());

    </script>

    </head>

    </html>

    Wheee! Okay, learned your lesson yet? Obviously you won’t want to do that to your visitor. Well, some of you will…like the guy with the funny hat. But if you want your visitors to come back, then slap that code into a button and offer it as an option instead of forcing it upon them.

    Here is the non-caveman code:


    <html>

    <head>

    <script type="text/javascript">

    function optional()

    {

    window.location.reload();

    }

    </script>

    </head>

    <body>

    <input type="button" value="Click Here to Reload the Page" onclick="optional()" />

    </body>

    </html>

    When the user clicks on the button, it triggers the optional() function, which reloads the page.

    Note that, depending on your browser, you may get a pop-up box like the one seen below:




    More JavaScript Articles
    More By James Payne


     

    JAVASCRIPT ARTICLES

    - Validating Digits and Dates with jQuery`s Va...
    - Validating Ranges, Emails, and URLs with jQu...
    - More Uses for the jQuery Tooltip Plug-in`s b...
    - Building Image-Based Tooltips with the jQuer...
    - Using the jQuery Tooltip Plug-in`s bodyHandl...
    - Using Rangelength, Min and Max with the Vali...
    - Using Minlength and Maxlength with the Valid...
    - Modifying Tooltip Coordinates with the jQuer...
    - Applying a Fade Out Effect with the jQuery T...
    - Tracking Mouse Movements with the jQuery Too...
    - Checking Online Forms with the Validator jQu...
    - Nested JavaScript Functions as Objects
    - The jQuery Tooltip Plug-in
    - Active Client Pages at the Server
    - ACP Tab Web Page







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