Window, document, form (properties, methods, events)

Source: Internet
Author: User

Window object
--Return value: The Window object it opens.
----var NewWindow = open (', ' _blank ');
--Property
The name of the----name window is determined by the connection to which it is opened (<a target= >) or frames page (<frame name= "..." >) or the Open () method called by a window (see below). Generally we do not use this attribute.
----status refers to what is displayed in the State bar below the window. You can change the display of the status bar by assigning values to status.
----opener usage: window.opener; Returns the Window object that opens this window. Note: A Window object is returned. If the window is not open by another window, this property returns Null in Netscape and "undefined" (undefined) in IE. Undefined to a certain extent equals null. Note: Undefined is not a JavaScript constant, and if you attempt to use "undefined", it really returns "undefined."
----self refers to the window itself, which returns objects that are exactly the same as window objects. The most commonly used is "self.close ()", placed in the <a> tag: "<a href=" Javascript:self.close () "> Close window </a>".
----Parent Returns the Frame Page object to which the window belongs.
----Top Returns the topmost Frame Page object that occupies the entire browser window.
--Method
Opens a window----open (). Usage: Open (<url string, < window name string, < parameter string >);
------parameter String
--------the number of pixels from the top of the screen at the top of the top=# window
--------left=# window left the number of pixels off the left side of the screen
--------the width of the width=# window
--------the height of the height=# window
--------menubar= ... Window has no menu, value Yes or no
--------toolbar= ... Window has toolbar, value Yes or no
--------location= ... window has no address bar, value yes or no
--------directories= ... window has no connection area, value Yes or no
--------scrollbars= ... Window has scroll bar, value Yes or no
--------status= ... Window has status bar, value Yes or no
--------resizable= ... window is not resized, value yes or no
----Close () closes an open window.
----blur () removes the focus from the window, and the window changes to an inactive window.
----Focus () is the window that gets the spotlight and becomes the active window. However, in Windows 98, this method only blinks the title bar of the window and the corresponding button on the taskbar, prompting the user that the window is trying to gain focus.
----Scrollto () Usage:[< window object. Scrollto (x, y); Scrolls the window so that the document (x, y) points from the top left corner to the upper-left corner of the window.
----Scrollby () Usage:[< window object. Scrollby (DeltaX, DeltaY), scrolling the window to the right deltax pixels, scrolling down deltay pixels. If a negative value is taken, it scrolls in the opposite direction.
----Resizeto () Usage:[< window object. Resizeto (width, height); Make window resize to wide width pixel, high height pixel.
----Resizeby () Usage:[< window object. Resizeby (Deltawidth, deltaheight), resizing the window, increasing the deltawidth pixel width, and increasing the deltaheight pixel height. If a negative value is taken, it is reduced.
----alert () Usage: alert (< string >); pops up a dialog box that contains only the OK button, which shows the contents of < string >, and the entire document reads and the Script runs until the user presses OK.
----Confirm () Usage: Confirm (< string >), pop-up A dialog box with OK and Cancel buttons, display < string > content, ask the user to make a choice, the entire document read, Script run will be paused. Returns a true value if the user presses OK, and returns a value of False if "cancel" is pressed.
----prompt () Usage: prompt (< string >[, < initial value); Pop up a dialog box with confirmation "Cancel" and a text box to display < string > content, asking the user to enter some data in the text box. The entire document will be paused for read, Script run. If the user presses confirm, returns what is already in the text box and returns a null value if the user presses Cancel. If you specify < initial value, the text box will have a default value.
--Events
----onload
----OnUnload
----onresize
----onblur
----onfocus
----OnError

The document Document object describes the documentation for the current window or for the specified Window object. It contains the contents of the document from --Usage: Document (current window) or < Window object >.document (Specify window)
--Properties:
----Cookies Refer to the "Use Frames and Cookies" chapter for cookies.
----LastModified The last modification date of the current document, is a Date object.
----referrer If the current document is opened by clicking on the connection, referrer returns the original URL.
----in the title refers to the <title>...</title> defined text in the ----Fgcolor refers to the text color represented by the Text property of the <body> tag.
----bgcolor refers to the background color represented by the bgcolor property of the <body> tag.
----LinkColor refers to the connection color represented by the link property of the <body> tag.
----Alinkcolor refers to the active connection color represented by the ALink property of the <body> tag.
----Vlinkcolor refers to the access connection color represented by the Vlink property of the <body> tag.
--Method
----Open () opens the document so that JavaScript can write data to the document's current position, which is where the JavaScript is inserted. This method is not usually required, and JavaScript is invoked automatically when needed.
----Write (); Writeln () writes data to the document, which is written to be treated as standard document HTML. The difference between writeln () and write () is that the Writeln () adds a newline after the data is written. This line is only in the HTML line, the specific situation can be displayed text line, depending on the location of the inserted JavaScript. If inserted in the <pre> tag, the line wrap is also reflected in the document.
----Clear () to empty the current document.
Closes the document----close () to stop writing data. If you use the WRITE[LN] () or clear () method, you must use the close () method to ensure that the changes are displayed.

Forms[]; Form Form Object
--Usage
----document.forms[] is an array that contains all the forms (<form>) in the document. To refer to a single form, you can use document.forms[x], but in general, people do this: add "name=" to the <form> tag, and then use the "document.< table Single-name >" To reference it directly.
--Property
The name of the form, which is the <form name= > property, is returned----name.
----Action Returns/sets the submission address of the form, which is <form action= "..." > Properties.
----method returns/sets the way the form is submitted, i.e. <form method= "..." > Properties.
----Target Returns/sets the window returned after the form is submitted, which is the <form target= "..." > property.
----Encoding Returns/sets the encoding of the form submission, which is <form enctype= "..." > Properties.
----length returns the number of elements that the form contains.
--Method
----Reset () resets the form. This is the same as pressing the "Reset" button.
Submit the form----submit (). This is the same as pressing the "Submit" button.
--Events
----OnReset
----onsubmit

JavaScript Document Object Structure

Browser Object Navigator
Screen Object Screens
Window object windows
Historical object History
Address Object Location
Frame Object frames[]; Frame
Documents Object Document
Connection object anchors[]; Links[]; Link
Java applet Object applets[]
Plugin Object embeds[]
Picture Object images[]; Image
Form Object forms[]; Form
Button Object buttons
check box Object checkbox
Form element Object elements[]; Element
Hidden Objects Hidden
Password Input Area object Password
Radio domain Object Radio
Reset button Object Reset
Select Area (Drop-down menu, List) object Select
Select Item Object options[]; Option
Submitting Button Object submit
Text Box Object text
Multi-line text input area object Textarea

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.