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 methods for javascript to get the face value of html pages?

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

Share

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

This article mainly explains "what are the methods for javascript to obtain html page values", the explanation content in the article is simple and clear, easy to learn and understand, please follow the ideas of Xiaobian slowly, together to study and learn "what are the methods for javascript to obtain html page values"!

javascript There are three ways to get html page values: 1. Use the "html element object [xss_clean]" statement to return the contents of the element;2. Use the "html element object.innerText" statement;3. Use the "input element object.value" statement to return the contents of the input box.

Operating environment of this tutorial: Windows 7 system, Javascript version 1.8.5, Dell G3 computer.

javascript There are 3 ways to get html page values

Using innerHTML attributes

Using the innerText attribute

Using the value attribute

innerHTML property

The innerHTML property sets or returns HTML between the element start and end tags.

It's a headline. This is a paragraph.

var nr = document.getElementById("p")[xss_clean]; alert(nr);

Using the innerText attribute

The innerHTML property sets or returns the text content between the element's start and end tags.

It's a headline. This is a paragraph.

var nr = document.getElementById("p").innerText; alert(nr);

Using the value attribute

The value property sets or returns the value of the input element

It's a headline. This is a paragraph.

var nr = document.getElementById("in").value; alert(nr);

Thank you for reading, the above is "javascript get html page value method what" content, after learning this article, I believe we have javascript get html page value method what this problem has a deeper understanding, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

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