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

Source: Internet
Author: User

Window object
-- Return value: the window object it opens.
---- Var newwindow = open ('', '_ blank ');
-- Attribute
---- Name of the window, opened by its connection (<a target = "... ">) or frame page (<frame name = "... ">) or the open () method called by a window (see below. This attribute is generally not used.
---- Status indicates the content displayed in the "status bar" below the window. By assigning values to status, you can change the display of the status bar.
---- Opener usage: window. opener; return the window object that opens the window. Note: A window object is returned. If the window is not opened by another window, null is returned for this attribute in Netscape; "undefined" is returned for IE ). Undefined is equal to null to some extent. Note: Undefined is not a javascript constant. If you attempt to use "undefined", "undefined" is returned.
---- Self refers to the window itself, which returns the same object as the window object. The most common is "self. close () ", placed in the <A> tag:" <a href = "javascript: Self. close () "> Close Window </a> ".
---- Parent returns the frame Page Object of the window.
---- Top returns the frame page object that occupies the top of the entire browser window.
-- Method
---- Open () opens a window. Usage: open (<URL string>, <window name string>, <parameter string> );
------ Parameter string
-------- Top = # number of rows at the top of the window that exit the screen
-------- Left = # number of records left when the left side of the window leaves the screen
-------- Width = # window width
-------- Height = # window height
-------- Menubar =... Is there any menu in the window? The value is yes or no.
-------- Toolbar =... does the window have a toolbar? The value is yes or no.
-------- Location =... Is there an address bar in the window? The value is yes or no.
-------- Directories =... does the window have a connection area? The value is yes or no.
-------- Scrollbars =... does the window have a scroll bar? The value is yes or no.
-------- Status =... does the window have a status bar? The value is yes or no.
-------- Resizable =... the window cannot be adjusted. The value is yes or no.
---- Close () Close an opened window.
---- Blur () removes the focus from the window and changes the window to an "inactive window ".
---- Focus () is the focus of the window, which is changed to "activity window ". However, in Windows 98, this method can only Flash the title bar of the window and the corresponding buttons on the taskbar, prompting the user that the window is trying to get the focus.
---- Scrollto () usage: [<window Object>.] scrollto (x, y); enables the window to scroll from the (x, y) points in the upper left corner of the window to the upper left corner of the window.
---- Scrollby () usage: [<window Object>.] scrollby (deltax, deltay); scroll the deltax pixel to the right of the window and scroll down the deltay pixel. If a negative value is obtained, it is rolled in the opposite direction.
---- ResizeTo () usage: [<window Object>.] resizeTo (width, height); enables the window to be adjusted to width, width, and height.
---- ResizeBy () usage: [<window Object>.] resizeBy (deltawidth, deltaheight); adjust the window size, increase the width of deltawidth pixels, and increase the height of deltaheight pixels. If the value is negative, the value is reduced.
---- Alert () usage: Alert (<string>); a dialog box containing only the "OK" button is displayed, showing the content of <string>, reading the entire document and running the script will be paused until the user presses "OK ".
---- Confirm () usage: Confirm (<string>); a dialog box containing the "OK" and "cancel" buttons is displayed, asking the user to make a selection, reading the entire document and running the script are paused. If you press "OK", true is returned. If you press "cancel", false is returned.
---- Prompt () usage: prompt (<string> [, <initial value>]); a dialog box containing "OK" and "cancel" and a text box is displayed, when <string> content is displayed, you must enter some data in the text box. The reading and running of the entire document will be suspended. If the user presses "OK", the existing content in the text box is returned. If the user presses "cancel", the return value is null. If <initial value> is specified, the default value is displayed in the text box.
-- Event
---- Onload
---- OnUnload
---- Onresize
---- Onblur
---- Onfocus
---- Onerror

Document Object describes the document of the current window or specified window object. It contains the content of the document from -- Usage: Document (current window) or <window Object>. Document (specified window)
-- Attribute:
---- For cookie information, see "use framework and cookies.
---- Lastmodified the last modification date of the current document, which is a date object.
---- Referrer if the current document is opened by clicking the link, the referrer returns the original URL.
---- Title refers to the text defined by ---- Fgcolor indicates the text color of the text attribute marked by <body>.
---- Bgcolor indicates the background color indicated by the bgcolor attribute marked by <body>.
---- Linkcolor indicates the connection color of the link Property marked by <body>.
---- Alinkcolor indicates the active connection color of the alink attribute marked by <body>.
---- Vlinkcolor indicates the accessed connection color of the vlink attribute marked by <body>.
-- Method
---- Open () open the document so that javascript can write data to the current location of the document (the location where Javascript is inserted. This method is usually not required and automatically called by javascript when necessary.
---- Write (); writeln () writes data to the document. The written data is treated as standard document HTML. The difference between writeln () and write () Is that writeln () adds a line break after data is written. This line feed is only a line feed in HTML. Whether it can be a line feed displayed depends on the position where Javascript is inserted. For example, if the <PRE> label is inserted, the new line feed is also reflected in the document.
---- Clear () clears the current document.
---- Close () Close the document and stop writing data. If the write [Ln] () or clear () method is used, you must use the close () method to ensure that the changes can be displayed.

Forms []; form object
-- Usage
---- Document. Forms [] is an array that contains all forms in the document (<form> ). To reference a single form, you can use document. forms [X], but in general, people will do this: Add "name =" in the <form> tag "... "" attribute, then directly use "document. <form name> "can be referenced.
-- Attribute
---- Name: return the form name, that is, the <form name = "..."> attribute.
---- Action: return/set the submission address of the form, that is, the <form action = "..."> attribute.
---- Method returns/sets the form submission method, that is, the <form method = "..."> attribute.
---- Target Returns/sets the window returned after the form is submitted, that is, the <form target = "..."> attribute.
---- Encoding: returns/sets the encoding method of the content submitted by the form, that is, the <form enctype = "..."> attribute.
---- Length returns the number of elements contained in the form.
-- Method
---- Reset () resets the form. This is the same as pressing the reset button.
---- Submit () submits the form. This is the same as pressing the submit button.
-- Event
---- Onreset
---- Onsubmit

JavaScript document object structure

Browser object Navigator
Screen Object
Window Object window
Historical object history
Address Object Location
Frame object frames []; Frame
Document Object document
Connection object anchors []; Links []; Link
Java Applet object applets []
Plug-in object embeds []
Image object images []; Image
Form object forms []; Form
Button Object
Check box object checkbox
Elements []; element
Hide object hidden
Password Field object Password
Single-choice domain object radio
Reset button object Reset
Select area (drop-down menu, list) object
Select option object options []; Option
Submit 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.