Summary of html5 functions and html5 Functions

Source: Internet
Author: User

Summary of html5 functions and html5 Functions

1. Table Elements

A. <caption> set the table title

B. <colgroup> and <col> set the column // style span

2. Grouping Element

A. <blockquote> Add line breaks and indentions at the beginning and end to the content of a large segment (with an outer margin)

B. <pre> displays the editor layout (usually used to display the Code, where the code is not executed)

C. <figure> used for image (<figcaption> is his title)

3. semantic tags

A.

B. <footer> indicates the tail end.

C.

D. <section> group titles.

E. <nav> store navigation

F. <article> store articles

G. <aside> you can make the article sidebar, The h1-h6 is bold, other labels are displayed as this

H. <adress> store the contact information

4. Audio and Video

Video audio video // playback of audio and video without relying on plug-ins

5. js Loading

Async asynchronously loads js (page parsing continues, script execution)

2 <script src="js1.js" async="async"></script>

 

6. Do not reload page History Management

History. back (); // return to the previous page

History. forward (); // move to the next page

History. go (-2); // takes an integer as the parameter and moves it to the page specified by this integer. No return value is returned.

 

History. go (0) is equivalent to refreshing the current page.

The history. pushState () method accepts the following three parameters:

 

State: A state object related to the specified URL. When a popstate event is triggered, the object is passed in a callback function. If you do not need this object, you can enter null here.

 

Title: The title of the new page, but this value is ignored by all browsers currently, so you can enter "" here "".

 

Url: The new url must be in the same domain as the current page. The URL is displayed in the address bar of the browser.

Ps: do not check whether the new website exists, but the address bar will be displayed and added to the history stack

Popstate event: When the browsing history (that is, the history Object) of the same document changes, the popstate event is triggered.

Only the pushState method or the replaceState method is called. This event is not triggered. Only the user clicks the browser backward button and forward button,

Or it is triggered only when the back, forward, and go methods are called using JavaScript.

In addition, this event is only for the same document. If the browsing history is switched, different documents will be loaded, and this event will not be triggered.

7. canvas and SVG

It can be used in small applications to produce superb results

8.html 5 web Storage

Small cookie storage, slow speed, and low efficiency

LocalStorage-data storage with no time limit

SessionStorage-data storage for a session

9. web workers

The javascript code running in the background does not affect the dom.

10. Obtain the geographic location

1 <p id = "demo"> click this button to obtain your coordinates: </p> 2 <button onclick = "getLocation () "> try </button> 3 <script> 4 var x = document. getElementById ("demo"); 5 function getLocation () {6 if (navigator. geolocation) {7 navigator. geolocation. getCurrentPosition (showPosition); 8} 9 else {10 x. innerHTML = "Geolocation is not supported by this browser. "; 11} 12} 13 function showPosition (position) {14 x. innerHTML = "Latitude:" + position. coords. latitude + 15 "<br/> longpolling:" + position. coords. longpolling; 16} 17 </script>

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.