Home arrow JavaScript arrow Page 3 - The Window Phase of Chrys`s Approach to ACP
JAVASCRIPT

The Window Phase of Chrys`s Approach to ACP


The Window Phase of Chrys’s Approach to ACP is similar to the Document Phase. However, instead of having HTML documents (pages) opened within one browser window, you open both browser windows. This is the ninth part of a twelve-part series on Active Client Pages.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
August 28, 2009
TABLE OF CONTENTS:
  1. · The Window Phase of Chrys`s Approach to ACP
  2. · Examples of Window Properties and Methods
  3. · Window name Property
  4. · Examples of Window Methods

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
The Window Phase of Chrys`s Approach to ACP - Window name Property
(Page 3 of 4 )

Definition and Usage

The name property sets or returns the name of the window.

Syntax

window.name=name

Example

The following example returns the name of the new window:


<html>

<head>

<script type="text/javascript">

function checkWin()

{

document.write(myWindow.name)

}

</script>

</head>

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

myWindow=window.open('','MyName','width=200,height=100')

myWindow.document.write("This is 'myWindow'")

</script><input type="button" value="What's the name of 'myWindow'?"

onclick="checkWin()"></body>

</html>


Window opener Property

Definition and Usage

The opener property returns a reference to the window that created the window.

Syntax

window.opener

Example

The following example writes some text to the opener window (parent window):


<html>

<body>


<script type="text/javascript">

myWindow=window.open('','MyName','width=200,height=100')

myWindow.document.write("This is 'myWindow'")

myWindow.focus()

myWindow.opener.document.write("This is the parent window")

</script>


</body>

</html>


Window self Property

Definition and Usage

The self property returns a reference to the current window.

Syntax

window.self

Example

The following example checks whether or not the window is in a frame -- and if it is, it breaks out of the frame:


<html>

<head>

<script type="text/javascript">

function breakout()

{

if (window.top!=window.self)

{

window.top.location="tryjs_breakout.htm"

}

}

</script>

</head>

<body><input type="button" onclick="breakout()"

value="Break out of frame!"></body>

</html>


tryjs_breakout.htm is a file in the same directory.

Window status Property

Definition and Usage

The status property sets or returns the text in the status bar of a window.

Syntax

window.status=sometext

Example

The following example sets the text in the status bar:


<html>

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

window.status="Some text in the status bar!!"

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