Js-javascript and DOM operations

Source: Internet
Author: User

1. HTML element Tag-Hypertext Markup Language
Decide what's on your Web page.

2. CSS-style sheet
Determine the style and layout of these element tags in your web page

3, Js-javascript
Determine the features and effects of these element tags in your web page

3.1. OnClick: Stand-alone
OnDblClick: Double-click


function execution functions

The Alert display box is only determined

Confirm display box has OK and cancel

Prompt below the display box

VAR universal variable


<body>

<a onclick= "A ()" ></a>
<script tipy= "Text/javascript" >

function A ()
{
Alert ("");
Confirm ("");
}


</body>


————————————————————————————————————————————

DOM Operations: Document Object Model


First, Window object
1, window.open ("link Address", "Open Location", "new Window Properties")
2, Window.close ();
3, Window.opener; open its web page
4, Window.resizeto (length, width);
5, Wondow.moveto (x, y);
6, Wondow.scrollto (x, y);


Second, Window.history object
Window.history.go (n); positive number, how many pages forward, negative number, back how many pages;
Window.history.back (); Back one page
Window.history.forward (); forward one page

Third, Window.location object:
Window.location.href: Get page address

Four. Window.status objects


Five. Window.document objects
var variable = document.getElementById (ID);
var variable = document.getelementsbyclassnaame (Class);
var variable = document.getelementsbyname (name);
var variable = document.getelementsbytagname (sign signature);
Variable. innerhtml= "Content";

--------------------------------------------------------
Manipulate the contents of non-form elements:
InnerHTML = ""; -Spell mark, will change the mark to the corresponding effect;
InnerText = ""; -no matter what the content is marked, write it all out;

If you take it out alone, you get the text content in the element.
InnerHTML-will take out all the inside.
InnerText-will take out all the contents of the content removal mark.

Js-javascript and DOM operations

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.