Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the methods for javascript to output values

Shulou Source: shulou.com Published: 2022-06-03 14:55:25 11月14日 Update

This article mainly introduces the methods of javascript output value, the article is very detailed, has a certain reference value, interested friends must read it!

1. Use the "window.alert" statement to output through the pop-up window.

2. Use the "element object .innerHtml =" output value "statement.

If you need 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.

Use the "[xss_clean] (" value ")" statement.

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.

Note: executing [xss_clean] () after the document has finished loading will overwrite the entire HTml page

4. Use the "console.log (value") statement.

If your browser supports debugging, you can use the console.log () method to display the JavaScript value in the browser.

Use F12 in the browser to enable debug mode, and click the "Console" menu in the debug window.

The above is all the contents of the article "what are the methods for outputting javascript values?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Content methods output elements statements browsers documents articles values interests functions objects guys partners attributes more tags logos patterns Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei MySQL MariaDB Shulou Tech Info Microsoft