Report software JS Development Windows object referencing HTML DOM

Source: Internet
Author: User

The HTML DOM is the standard (the English abbreviation for the HTML Document Object model, document object models for HTML).

The HTML DOM defines some of the column standards for HTML objects, as well as the standard way to access and manipulate HTML documents.

Through the DOM, you can access all the HTML elements, along with the text and attributes they contain. You can modify and delete the content, and you can also create new elements.

All HTML DOM objects (Windows objects, location objects, document objects) can be accessed and processed in JavaScript, dynamically modifying Web pages.

Here is also a more popular report software Finereport as an example, first introduce the Windows object.

Window Object

Window objects represent open windows in the browser.

If the document contains a frame (frame or iframe label), the browser creates a Window object for the HTML document and creates an additional window object for each frame.

The Window object represents a browser window or a frame. In client-side JavaScript, the Window object is a global object, and all expressions are evaluated in the current environment.

Window objects can be referenced through window, which is typically done directly using the Winodw method. If you can write only document, do not write window.document.

Similarly, the method of the current Window object can be used as a function, such as write only alert (), without having to write Window.alert ().

Window Common Properties for Objects

Property Description

Closed returns whether the window has been closed

Document read-only reference to document object

Innerheight returns the height of the window document display area

Innerwidth returns the window document display area width

Location object for a window or frame

Name Sets or returns the window name

Parent returns to parents window

Window Common methods for objects

Method description

Alert () Displays a warning box with a message and a confirmation button.

Close () Closes the browser window.

Confirm () Displays a dialog box with a message along with a confirmation button and a Cancel button.

Open () Opens a new browser window or looks for a named window.

Prompt () Displays a dialog box to prompt the user for input.

Example

Close () Method

Close the browser window by default to close the current window, or you can close the current window by Self.close ().

alert () Method

Displays a warning box with a message and a confirmation button. The effect is as follows:


<script type= "Text/javascript" >  function  display_alert ()    {    alert ("I am an alert box!! " )    }  

confirm () Method

Displays a dialog box with a message and a confirmation button and a Cancel button. Click OK, return True, click Cancel, return False


promt () Method

The prompt () method is used to display a dialog box that prompts the user for input. Syntax for

Prompt (Text,defaulttext)  

Returns NULL if the user clicks the Cancel button of the prompt box. Returns the text that is currently displayed in the input field if the user clicks the Confirm button

It will block all user input to the browser until the user clicks the OK button or the Cancel button to close the dialog box. When prompt () is called, execution of the JavaScript code is paused, and the next statement is not executed until the user responds

<script type= "Text/javascript" >function  disp_prompt ()  {  var name=prompt ( "Pleaseenter your name", "")  if (name!=null && name!= "")    {    document.write ("Hello" + name + "!") )    }  }</script>

Open () Method

Open a new browser window or look for a named window. Use syntax:

window.open (Url,name,features,replace)

The URL is an optional string that declares the URL of the document to display in a new window. If this argument is omitted, or if its value is an empty string, then the new window will not display any documents.

name An optional string that is a comma-delimited list of features, including numbers, letters, and underscores that declare the name of the new window. This name can be used as the value of the property target that marks ' a ' and ' form '. If the parameter specifies a window that already exists, the open () method no longer creates a new window, but simply returns a reference to the specified window. In this case, the features will be ignored.

features An optional string that declares the characteristics of the standard browser to be displayed for the new window. If this argument is omitted, the new window will have all standard features

Replace with an optional Boolean value. Specifies whether the URL loaded into the window creates a new entry in the window's browsing history or replaces the current entry in the browsing history. The following values are supported: True-url replaces the current entry in the browsing history. False-url creates a new entry in the browsing history.

print () Method

Used to print the contents of the current window.

The call to the print () method causes the behavior to be as if the user clicked the browser's printing button. Typically, this produces a dialog box that allows the user to cancel or customize the print request.

Report software JS Development Windows object referencing HTML DOM

Related Article

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.