Frame Object

By: aathishankaran Emailed: 1787 times Printed: 2615 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

The frame, object is essentially the same element as a window object, and you can deal with it in a similar manner. If you are working with a single window, the window object is the top-level object. If you are working within a frameset, the top-level window is considered the parent window, whereas its child windows are considered frame objects.

Location Object 

The location object encapsulates the URL of the current page. It’s enabling you to 

  1. Set the location object to move to a new URL.
  1. Extract specific elements of the URL and work with them. Without the location object, you would be forced to perform string manipulations on a URL string to get at the information you need.

The basic structure of a URL is as follows: 

protocol//hostname: port pathname search hash 

A typical URL could look something like the following:  

Attribute Description


Complete URL


Initial element of a URL (before and including colon)


Host and domain name or IP address


Hostname: port element of a URL


Communications port of the server


Path element of a URL


Query definition portion of a URL (begins with a 7)


Anchor name of a URL (begins with an #)

 History Object 

If you have surfed the Web at all, you are probably very familiar with a browser's history list. Just as the history list allows a user to traverse where she has been, JavaScript's history object enables you as a JavaScript developer to maneuver through Web pages that have been visited. 

Determining the Size of the list 

You can use the length () property of the history object to determine the number of entries in the list. For example, suppose you want to track the number of history list entries in the right frame of a multiframe window. The left frame contains the following code: 



<SCRIPT LANGUAGE = "JavaScript">

function moveon()


var urlAddress = " " urlAddress = document.forms [0].Edit1.value

parent.frames[1].location = urlAddress document.forms[0].Edit2.value

= parent. frames [1] .history.length






<INPUT type="text" name="Edit1">

<INPUT type="button" value="move" onClick="moveon()">

<INPUT type="text" name="Edit2">




The user can use the Edit1 text object to enter a URL to move to. As the user clicks the Move button to move to the URL, the Edit2 text object is updated to provide the length of the history list for the right frame. 

Navigating the History List 

Just knowing the length of the history list is rarely useful, but it can become useful when you want to navigate a list using the history object methods back (), forward(), and go (). 

Back Page 

The back () method is the functional equivalent of clicking the back (left-arrow) button on the browser's toolbar. For example, the following code moves a window to its previous position: 


Forward Page 

As you would expect, the forward () method is the same as clicking the right arrow button on the browser's toolbar. It is used as follows: 


Specific Page Based on Number 

The go () method jumps to a specific place in the history list. Its syntax follows: 

[window.]history.go(delta | "location") 

The delta parameter is a positive or negative integer that can specify the number of places to jump. For example, the following line moves to the next document in the history list 

(the equivalent of using the forward () method): 


The following list details the delta value: 

delta < 0 Moves backward delta number of entries

delta> 0 Moves forward delta number of entries

delta =0 Reloads the current document

JSP Home | All JSP Tutorials | Latest JSP Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.

Bookmark and Share


Be the first one to add a comment

Your name (required):

Your email(required, will not be shown to the public):

Your sites URL (optional):

Your comments:

More Tutorials by aathishankaran
Web Security Issues
The Web User's Perspective
Server-side plug-Ins
The best way to avoid security vulnerabilities with new server
JavaScript Security
Window Object
Working with Status Bar Messages
Retrieving a Portion of a String
Referencing Windows
Math Object
Frame Object
Document Object
Closing Windows
Built-in Object in Javascript
Textarea Object

More Tutorials in JSP
LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: ` Permission denied <null>:80
JSP Alert Example
JSP CheckBox Example
Uploading an Image to a Database using JSP
Uploading a file to a server using JSP
A JSP page that gets properties from a bean
The page Directive in JSP
The taglib, tag, include, attribute and the variable Directive in JSP
Declarations in JSP
Scriptlets and Expressions in JSP
Tag Libraries in JSP
The Request Object in JSP
The Response Object in JSP
The Out Object in JSP
The Session Object in JSP

More Latest News
Most Viewed Articles (in JSP )
JSP Example to connect to MS SQL database and retrieve records
What are the different scopes in JSP?
JSP CheckBox Example
JSP Alert Example
Comparison operators in JSP
Sending Email using JSP
Uploading an Image to a Database using JSP
Arithmetic Evaluation Using the Expression Language in JSP
The Advantages of JSP
Disabling Scriptlets in JSP using web.xml
The Request Object in JSP
Writing your first JSP page
Uploading a file to a server using JSP
Deploying an Individual JSP on Tomcat
Automatically Refreshing a JSP
Most Emailed Articles (in JSP)
Calling JSP from a batch file
Simple HTML-Building Utilities
Handling Events
The Tag Life Cycle with Attributes in JSP
JSP Program for display Date
Sessions in JSP
The Advantages of JSP
Using a DataSource from WebLogic in a JSP
The JSP Program running first Time.
JSP pages in servlet
Combining Scriptlets with HTML
Declaring variable in JSP
An Example Using Servlet Initialization and Page Modification Dates
Password Object