Home arrow JavaScript arrow Page 3 - Methods of the DOM Location Object
JAVASCRIPT

Methods of the DOM Location Object


In my last article I discussed the Dom Location Object Properties. Here, we will go over the Methods of those same objects, and if there is time, I will even cover the History Objects, which give you control over the user’s history list, allowing you to give them access to past URLs and advanced navigation.

Author Info:
By: James Payne
Rating: 5 stars5 stars5 stars5 stars5 stars / 2
December 08, 2008
TABLE OF CONTENTS:
  1. · Methods of the DOM Location Object
  2. · Assign() Gives You Tasks
  3. · The Jatrix…Reloaded()
  4. · Replace()

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

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:





blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Tutorials for Beginners
- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 2 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials