What are the ways of page output in html5
Editor to share with you what are the ways of page output in html5, I hope you will gain something after reading this article, let's discuss it together!
Page output methods are: 1, use the "window.alert ('content');" statement pop-up warning box; 2, use the "element object [xss_clean] =" content "statement to insert new content into the specified element; 3, use the" docuemnt.write ("content") "statement to write the new content into the HTML document.
The operating environment of this tutorial: windows7 system, HTML5 version, Dell G3 computer.
Html5 page output mode
Use window.alert () to pop up the warning box
Use the [xss_clean] () method to write content to an html document
Use the element object .innerHtml = "value to be written"; write to the HTML element
1. Use window.alert ()
Window.alert ('warning box')
2. Manipulate HTML elements
To require JavaScript to access a HTML element, you can use the document.getElementById (id) method
Use the id attribute to identify the HTML element, and innerHTml to get or insert the element content:
My first paragraph
Document.getElementById ("demo") [xss_clean] = "paragraph modified"
Document.getElementById ("demo") is the JavaScript code that uses the id attribute to find the HTML element. This method is defined in HTML DOM.
InnerHTML = "Paragraph changed." Is the JavaScript code used to modify the HTML content (innerHTML) of an element.
3. Write to HTML document
Use the [xss_clean] () method to write content to HTML content, which allows you to write content or html tags directly to an html document
Docuemnt.write (Date ()); / / Date () exports China Standard time
Note: executing [xss_clean] () after the document has finished loading will overwrite the entire HTml page