Pages

Sunday, 30 September 2012

Navigation with Java Script Open Function


Mostly we navigate on different using <a></a> tag you can navigate on different pages
Using Java script window.open function which you a lot of option with navigation.. 
Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the sUrl parameter and the sName parameter to collect the output of the write method and the writeln method.
Syntax
oNewDoc = document.open(sUrl [, sName] [, sFeatures] [, bReplace])
Parameters
sUrl
Required. When a new document is opened, sUrl is a String that specifies a MIME type for the document. When a new window is opened, sUrl is a String that specifies the URL to render in the new window. If a sUrl is not specified, a new window with about:blank is displayed.
text/html
Default. Currently the only MIME type supported for this method.
sName
Optional. When a new document is opened, specify the String replace for sName to specify that the new document replaces the current document in the history list. If the replace value is not specified when you open a document, a new entry is added to the history list. When a window is opened, this is a String that specifies the name of the window. The value of this parameter can be specified as the value of the TARGET attribute for a form or an a element. This value defines this new window as the location to load a document.
replace
This value is only used to open a new document, and specifies that the new document replaces the current entry in the history list.
_blank
When a window is opened, the sUrl is loaded into a new, unnamed window.
_parent
When a new window is opened, the sUrl is loaded into the current frame's parent. If the frame has no parent, this value acts as the value _self.
_search
Disabled in Windows Internet Explorer 7, see Security and Compatibility in Internet Explorer 7 for details. Otherwise, when a window is opened, the sUrl is opened in the browser's search pane in Microsoft Internet Explorer 5 or later.
_self
When a window id opened, the current document is replaced with the specified sUrl .
_top
sUrl replaces any framesets that are loaded. If there are no framesets defined, this value acts as the _self value.
_media
The sUrl is loaded in the Media Bar in Internet Explorer 6. Microsoft Windows XP Service Pack 2 (SP2) and later. This feature is no longer supported. By default the sUrl is loaded into a new browser window or tab.
sFeatures
Optional. This String parameter is a list of comma-separated items. Each item consists of an option and a value, separated by an equals sign (=), for example, "fullscreen=yes, toolbar=yes". The following features are supported.
channelmode = { yes | no | 1 | 0 }
Specifies whether to display the window in theater mode. The default is no.
Internet Explorer 7. channelmode = { yes | 1 } overrides the height value, the width value, the top value, and the left value. When active, the Navigation Bar is hidden, and the Title Bar is visible. The Channel Band is no longer supported in Internet Explorer 7.
Prior to Internet Explorer 7 channelmode = { yes | 1 } displays the Channel Band in theatre mode.
directories = { yes | no | 1 | 0 }
Specifies whether to add directory buttons. The default is yes.
Internet Explorer 7. This feature is no longer supported.
fullscreen = { yes | no | 1 | 0 }
Specifies whether to display the browser in full-screen mode. The default is no. Use full-screen mode carefully. Because this mode hides the browser's title bar and menus, you should always provide a button or other visual clue to help the user close the window. ALT+F4 closes the new window.
Internet Explorer 7. A window in full-screen mode does not have to be in theatre mode.
Prior to Internet Explorer 7, a window in full-screen mode must in theater mode (channelmode).
height = number
Internet Explorer 7. Sets the height of the window in pixels. The minimum value is 150, and specifies the minimum height of the browser content area.
Prior to Internet Explorer 7, the minimum height value is 100.
left = number
Specifies the left position, in pixels. This value is relative to the upper-left corner of the screen. The value must be greater than or equal to zero.
location = { yes | no | 1 | 0 }
Internet Explorer 7. Specifies whether to display the navigation bar. The default is yes.
Prior to Internet Explorer 7, this feature specifies whether to display the address bar.
The Back command, the Forward command, and the Stop command are now located in the Navigation bar. Prior to Internet Explorer 7, navigation commands were located in the toolbar.
menubar = { yes | no | 1 | 0 }
Specifies whether to display the menu bar. The default is yes.
Internet Explorer 7. By default the menu bar is hidden, unless it is revealed by the ALT key. menubar = { no | 0 } prohibits the menubar from appearing even when the ALT key is pressed.
The combination of menubar = { no | 0 } and toolbar = { no | 0 } hides the toolbar and disables any additional third-party user interfaces.
resizable = { yes | no | 1 | 0 }
Specifies whether to display resize handles at the corners of the window. The default is yes.
Internet Explorer 7. resizable = { no | 0 } disables tabs in a new window.
scrollbars = { yes | no | 1 | 0 }
Specifies whether to display horizontal and vertical scroll bars. The default is yes.
status = { yes | no | 1 | 0 }
Specifies whether to add a Status Bar at the bottom of the window. The default is yes.
titlebar = { yes | no | 1 | 0 }
Specifies whether to display a Title Bar for the window. The default is yes.
Internet Explorer 5.5 and later. This feature is no longer supported. The Title Bar remains visible unless the fullscreen sFeature is active.
This parameter is ignored prior to Internet Explorer 5.5. It applies only if the calling application is an HTML Application or a trusted dialog box.
toolbar = { yes | no | 1 | 0 }
Internet Explorer 7. Specifies whether to display the browser command bar, making buttons such as Favorites Center, Add to Favorites, and Tools available. The default is yes.
The combination of menubar = { no | 0 } and toolbar = { no | 0 } turns off the Toolbar and any additional third-party user interfaces.
Prior to Internet Explorer 7, the toolbar sFeature specifies whether to display the browser toolbar, making buttons such as Back, Forward, and Stop available.
top = number
Specifies the top position, in pixels. This value is relative to the upper-left corner of the screen. The value must be greater than or equal to zero.
width = number
Internet Explorer 7. Sets the width of the window in pixels. The minimum value is 250, and specifies the minimum width of the browser content area.
Prior to Internet Explorer 7, the minimum height value is 100.
bReplace
Optional. When the sUrl is loaded into the same window, this Boolean parameter specifies whether the sUrl creates a new entry or replaces the current entry in the window's history list.
true
sUrl replaces the current document in the history list
false
sUrl creates a new entry in the history list.
Return Value
Returns a reference to the new document object or the window object. Use this reference to access properties and methods of the new document or window.
Remarks
When a function fired by an event on any object calls the open method, the window. The open method is implied.
<script language="JScript">
function myOpen() {
    open('about:blank');}
</script>
<body onclick="myOpen();">
Click this page and window.open() is called.
</body>
When an event on any object calls the open method, the document.open method is implied.
<button onclick="open('Sample.htm');">
Click this button and document.open() is called.
</button>
As of Internet Explorer 6, the _media value of the sName parameter specifies that this method loads a URL in the Media Bar.
Example
The following example shows how to use the open method to replace the current document with a new document and display the HTML markup contained in the variable sMarkup.
<html>
<head>
<title>First Document</title>
<script>
function replace(){
    var oNewDoc = document.open("text/html", "replace");
    var sMarkup = "<html><head><title>New Document</title></head><body>Hello, world</body></html>";
    oNewDoc.write(sMarkup);
    oNewDoc.close();
}
</script>
</head>
<body>
<h1>I just want to say</h1><br>
<!--Button will call the replace function and replace the current page with a new one-->
<input type ="button" value = "Finish Sentence" onclick="replace();">
</body>
</html>

1 comment: