JavaScript document.write newline
JavaScript document.write can be used to output text strings, and even can output strings containing HTML tags. This article mainly introduces how to use HTML wrap tags to make document.write output text strings with a wrap effect, just like direct Write the content of the article in the HTML page like a newline paragraph.
JavaScript document.write basic syntax
document.write('Write the text you want to present here');
Just write HTML line break tag <br> or paragraph tag <p> directly in the parentheses of document.write. Note that the part containing HML line break tag must be enclosed in quotation marks, either single or double quotation marks Yes, if the quotation marks are omitted, the newline tag will be treated as a variable and make an error.
JavaScript document.write line break example
document.write('This is the first line<br>');
document.write('This is the second line<br>');
document.write('<p>This is The first paragraph</p><p>This is the second paragraph</p>');
</script>
this is the second line
This is the first paragraph
This is the second paragraph
Post a Comment
0 Comments