Full-stack JavaScript path (18) HTML5 custom data attributes, javascripthtml5

Source: Internet
Author: User

Full-stack JavaScript path (18) HTML5 custom data attributes, javascripthtml5

HTML5 specifications stipulate that you can customize non-standard attributes for elements, but you need to add a data-prefix.


The purpose is to provide elements with information or semantic information irrelevant to page rendering. These attribute names can be added at will, as long as they start with the prefix "data.


<div id="myid" data-appid="1" data-appname="csdn"></div>

After adding the property, you can access the custom property through dataset. The dataset property is an instance of the DOMStringMap type and a key-value pair of key: value.

Registration: each data-name type attribute corresponds to the name attribute of dataset.

In the preceding example;

var div = document.getElementById("myid");div.dataset.appid ===' 1'; //truediv.dataset.appname ==='nama';//true

You can set custom native values:

div.dataset.appid = "100"






How to query data latency in javascript web databases in HTML5

Because your db. transaction (function (tx) {}) and alert (account. account); return account; are executed at the same time
The database is returned before the query is complete. You can perform the value transfer operation in db. transaction (function (tx.
 
HTML5, CSS, and JAVASCRIPT related science

HTML 5 has two major features: First, it enhances the performance of Web pages. Second, added the functions of local databases and other Web applications. In a broad sense, HTML5 refers to a set of technical combinations including HTML, CSS, and JavaScript. It hopes to reduce the browser's need for rich plug-ins for network application services (plug-in-based rich internet application, RIA), such as Adobe Flash, Microsoft Silverlight, and Oracle JavaFX, it also provides more standard sets that can effectively enhance network applications.

Cascading Style Sheet (CSS) is also called Style Sheet. It is used for webpage Style design. For example, if you want to make the link word blue when it is not clicked, the word turns red and underlined after the mouse moves up, which is a style. You can set up a style sheet to control the display attributes of each sign in HTML. Cascading Style Sheets allow users to more effectively control the appearance of webpages. Using Cascading Style Sheets, you can expand the ability to precisely specify the location, appearance, and create special effects of webpage elements.

JavaScript is a client scripting language that is based on objects and events and is relatively secure. It is also a scripting language widely used in client Web development. It is often used to add dynamic functions to HTML Web pages, such as responding to various user operations. Originally designed by Brendan Eich of Netscape, Netscape is a dynamic, weak-type, prototype-based language with built-in support classes. JavaScript is a registered trademark of Sun. Ecma International has developed ECMAScript standards based on JavaScript. JavaScript can also be used in other scenarios, such as server-side programming. The complete JavaScript implementation consists of three parts: ECMAScript, Document Object Model, and byte sequence mark.

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.