Home arrow JavaScript arrow Page 3 - Active Client Pages: More Questions and Answers on Chrys`s Approach
JAVASCRIPT

Active Client Pages: More Questions and Answers on Chrys`s Approach


This is the third part of my series, "Active Client Pages: Chrys’s Approach." We continue to learn the roots that give rise to my approach to Active Client Pages. We will also answer more questions about the technique and its capabilities.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
July 17, 2009
TABLE OF CONTENTS:
  1. · Active Client Pages: More Questions and Answers on Chrys`s Approach
  2. · Can any document use Ajax?
  3. · Can you create your own Back and Forward buttons?
  4. · The DOM go() Method

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Active Client Pages: More Questions and Answers on Chrys`s Approach - Can you create your own Back and Forward buttons?
(Page 3 of 4 )

When you load (create) a document at the client, the browser is supposed to enable the Back and Forward buttons accordingly. Some browsers may not do this. So the question is, can you create your own on each web page? Yes you can. You need to use the DOM History Object. The property and methods of this object are as follows:

 

History Object Properties

Property

Description

length

Returns the number of elements in the history list

 

History Object Methods

 

Method

Description

back()

Loads the previous URL in the history list

forward()

Loads the next URL in the history list

go()

Loads a specific page in the history list

 

The DOM length Property

Definition and Usage

The length property returns the number of elements in the history list.

Syntax

history.length

Example

 

<html>

<body><script type="text/javascript">

document.write(history.length);

</script></body>

</html>

 

If you try the above code in your home computer, the answer will be zero.  

The DOM back() Method

Definition and Usage

The back() method loads the previous URL in the history list.

This is the same as clicking the Back button or history.go(-1) (see later). 

Syntax

history.back()  

Example

The following example creates a back button on a page:

 

<html>

<head>

<script type="text/javascript">

function goBack()

{

window.history.back()

}

</script>

</head>

<body><input type="button" value="Back" onclick="goBack()" /></body>

</html>

 

The DOM forward() Method

Definition and Usage

The forward() method loads the next URL in the history list.

This is the same as clicking the Forward button or history.go(1) (see later).

Syntax

history.forward()

Example

The following example creates a forward button on a page:

 

<html>

<head>

<script type="text/javascript">

function goForward()

{

window.history.forward()

}

</script>

</head>

<body><input type="button" value="Forward" onclick="goForward()" /></body>

</html>

 


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 10 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials