Some practical techniques for JavaScript summary _javascript tips

Source: Internet
Author: User
JS Object Table Table object (excerpt)

Table Object Collection

Table object: Represents the tables in an HTML document, and the browser creates a Table object for each <table> tag in the document.

Collection

Describe

Cells[] Get an array that contains all the cells in a table

JS fetch row in column
Copy Code code as follows:

var tbodyobj = document.getElementById (Tbodyid);
Tbodyobj.rows[rowid].cells[colid].innertext = "ABCD";
tbodyobj.rows[rowid].cells[colid].innerhtml = "ABCD
(innerHTML refers to the HTML code, innertext refers to the display of text);


document.documentelement and Document.body.
This is the root node of the body child node and the entire node tree in the DOMDocument object.

Dom refers to each object in the hierarchy as a node, is a hierarchy, you can understand as a tree structure, like our directory, a root directory, the root directory has subdirectories, subdirectories also have subdirectories.

In the case of HTML Hypertext Markup Language: One root of the entire document is &LT;HTML&GT, which can be accessed using document.documentelement in the DOM, which is the root node of the entire node tree. And the body is a child node, to access the body tag, in the script should be written: Document.body.

understanding of several methods of Offsetlet,offsettop,scrollleft,scrolltop
Keywords: offsetlet, offsettop, ScrollLeft, scrolltop
1.offsetTop:
The distance from the current object to the top of its parent layer.
It cannot be assigned. Set the distance of the object to the top of the page use the Style.top property.

2.offsetLeft:
The distance from the current object to the left of its parent layer.
It cannot be assigned. Set the distance of the object to the left part of the page using the Style.left property.

3.offsetWidth:
The width of the current object.
The difference with the Style.width property is that if the width setting of the object is a percentage width, the style.width returns this percentage, regardless of whether the page is larger or smaller, and offsetwidth returns the width of the object in different pages instead of the percent value

4.offsetHeight:
The difference between the Style.height property and the

some knowledge of JS operation IFrame
1. Print iframe
eg. FrameName.document.execCommand (' print ');
2. Get IFRAME
eg. var Ifr_window = window.frames["FrameName"];
3. Get the elements in the IFRAME
Eg1. Place the element with ID ElementID in the IFRAME as not displayed:
var Ifr_window = window.frames["FrameName"];
Ifr_window.elementId.style.display = ' None ';
EG2. Get the table with ID listtable in the IFRAME
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.