Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the ways of page output in html5

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report