We accept safe and secure Credit Card and PayPal Payments.
 
Perl Scripts

All Count
Attachment Mailer
Perl Scripts Build A FAQ Plus
Perl Scripts Clock In Center
eBackup Automated
Easy Poll
eSurvey
Fetch a File
Form Maker
Mailing List Server
MySQL Mate
PDF Creation
QCart
Quick Fix
Quote of the day
Speed Search
Task Manager
Traffic Pack
Upload Plus
Upload Gold
Upload Pro
Website Manager

 
Free Perl Downloads

Free Perl Scripts Main Page
Free Perl Scripts 404 Alerter
AccessLog Viewer
Build A FAQ
PHP Scripts eBackup
Free PHP Scripts ErrorLog Viewer
eVars - Server Info
HT Pass Creator
Upload Lite
Website Manager

 
JavaScripts

Free Java Scripts Alert Boxes
Free JavaScripts Browser Sniffer
Check email
Generators
Slide Show
Sudoku
Window Maker
More...

 
Extra Utilities

ASP Scripts Ascii Codes
Free ASP Scripts Color Picker
Font Finder
HT Pass Creator
Meta Cloak
Meta Magic
Pano Zooms
SlideShow
Server Size

 
Online Tutorials

Free HTML Scripts Glossary
Free HTML Scripts HTML
JavaScript
MySQL
SSI
Build Traffic
Other

 
Miscellaneous

About Us
Graphics
Testimonials
Installations
Latest versions

 
Hawk Eye in Tennis

Should Hawk Eye replace linesmen and lineswomen at all tennis tournaments?







 
View all Polls

Run Polls on your site

Run your own Surveys

 
Store Download FAQs Contact Us Support Programming Policies  
JavaScript -> Window Object        

How do I create a pop up or pop down window?

What is the window object?

How do I reference the window that opens a new window?

How do I close the main window after it's opened a new window?

How do I read or set the current window's size?




How do I create a pop up or pop down window?

See our pop up window generator.

Top


What is the window object?

A browser window. The window object is a top level client side object. There is nothing above the window object. Javascript is an object orientated language. That is, you start with an object and apply methods to it's properties or the properties of it's object groups. For example, the document object is an object of the window object. To change the document's background color, you'd set the document's bgcolor property.

window.document.bgcolor = "red"

Top


How do I reference the window that opens a new window?

By using the opener property of the window object. A form in the main window can be referenced the same way. Eg.

text = window.opener.document.formname.formfield.value

where "formname" is the name you've given to your form using the name attribute and formfield is the name of the form field you're wanting to reference

Top


How do I close the main window after it's opened a new window?

window.opener.close()

To change the opener's bgcolor :

window.opener.document.bgcolor='red'

Top


How do I read or set the current window's size?

Netscape and IE use different properties for reading the size of a window. You set the size of a current window in Netscape by setting the innerHeight and innerWidth or outerHeight and outerWidth properties. Inner refers to the window's content area (where your HTML sits) and Outer refers to the windows borders (the size of the whole browser window).

To read the values in Netscape :

<script>
oH = window.outerHeight;
oW = window.outerWidth;
alert("Height: " + oH + "px Width: " + oW + "px");
</script>

To set the current window's dimensions in Netscape

<script>
window.outerHeight = 500;
window.outerWidth = 400;
</script>

You can place the script anywhere in you HTML document. The closer to the top, the quicker the script will be read and executed. Use the innerWidth and innerHeight to control the size of the content area.

The method used to resize the Window in Internet Explorer is as such:

<script>
self.resizeTo(500,400);
</script>

where 500 is the width and 400 is the height. To read the size of the window's content area in Internet Explorer you must place this script after the <body> tag :

<script>
iW = document.body.clientWidth;
iH = document.body.clientHeight;
alert("Inner Width: " + iW + "px Inner Height:" + iH);
</script>

Internet Explorer also has executes the following methods

self.resizeBy(x,y);
self.moveTo(x, y);
self.moveBy(x,y);

where x and y are the absolute pixel positions. That is, you use numbers in place of x and y.

Top


Speed Search our site
Survey Software
Create unlimited web based surveys on your website from your website

Plesk Hosting
Linux servers with Plesk Control Panel, cgi-bin, crontab manager, Mysql, PHP and ASP.

Discounted Scripts
Subscribe to our periodial newsletter to receive special offers.

Bathroom Hygiene
How often do you thoroughly clean your bathroom?








View all Polls

Run Polls just like this one on your website!


About us | Contact us | Script FAQs | Script Support | Website Hosting | Our Policies | Store | Testimonials
Subscribers log in here. Subscribe to our periodical newsletter for special offers on commercial scripts, hosting, exciting business opportunities, and industry news and events. Our Mailing List Software is powered by Consolidator    
HTML Plain text
©1999 - 2015 All content Copyright PerlScriptsJavaScripts.com Proudly hosted by LinuxHostingPlans.com