Traversing History (Moving Back and Forward using JavaScript)

JavaScript enables user to go back to some page in history. Similarly a forward button can also be configured using javascript.

BACK :

1. <FORM>
     <INPUT type=”button” value=”Click here to go back” onClick=”history.back()”>
    </FORM>

2.  <FORM>
      <INPUT type=”button” value=”Click here to go back” onClick=”history.go(-1)”>
    </FORM>

3. buttonTest.Attributes.Add(“onClick”,”javascript:history.back();”);

4. buttonTest.Attributes.Add(“onClick”,”javascript:history.go(-1);”);

FORWARD :

1. <FORM>
     <INPUT type=”button” value=”Click here to go back” onClick=”history.forward()”>
    </FORM>

2.  <FORM>
      <INPUT type=”button” value=”Click here to go back” onClick=”history.go(1)”>
    </FORM>

3. buttonTest.Attributes.Add(“onClick”,”javascript:history.forward();”);

4. buttonTest.Attributes.Add(“onClick”,”javascript:history.go(1);”);

Advertisements

~ by Neha Sinha on February 6, 2008.

One Response to “Traversing History (Moving Back and Forward using JavaScript)”

  1. Hi, Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: