Javascript DOM HTML Document write() Method

Introduction

Write some text directly to the HTML document:

document.write("Hello World!");

View in separate window

<!DOCTYPE html>
<html>
<body>

<script>
document.write("Hello World!");
</script>/*from w w w. j a  v a2  s .c om*/

</body>
</html>

The write() method writes HTML expressions or JavaScript code to a document.

If it is used after an HTML document is fully loaded, it will delete all existing HTML.

document.write();

Parameter Values

Parameter Description
exp1, exp2, exp3, ... Optional. What to write to the output stream.

Multiple arguments can be listed and they will be appended to the document in order of occurrence

P:The write() method returns No value.




PreviousNext

Related