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

    - Using jQuery to Preload Images with CSS and ...
    - Using Client-Side Scripting to Preload Image...
    - Removing Non-Semantic Markup when Preloading...
    - Using the Display CSS Property to Preload Im...
    - Preloading Images with CSS and JavaScript
    - Scaling and Moving Web Page Elements with th...
    - Fading, Hiding and Sliding HTML Elements wit...
    - Toggling CSS Properties with the GX JavaScri...
    - Cancel, Queue and Pause Animations with the ...
    - Producing Elastic Effects with the GX JavaSc...
    - Moving Divs Diagonally with the GX JavaScrip...
    - Moving Elements Vertically and Horizontally ...
    - Making Bouncing Effects in Parallel with the...
    - Creating Bouncing Effects with the GX JavaSc...
    - Manipulating Background Colors with the GX J...







    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek