Return to Kroll Design home page

JavaScript Tutorials

« Return

write() method

document.write writes html.
"string" can be a variable or a literal.
Multiple strings to write can be handled by one document.write statement, the strings separated by commas or plus signs.


<script type="text/javascript">
document.write("This is a literal", "<br><br>");
firstName = "John";
lastName = "Smith";
document.write("This uses commas for concatenation: ", firstName, " ", lastName, "<br>");
document.write("This uses plus signs for concatenation: " + firstName + " " + lastName + "<br>");


« Return

©2012 Kroll Design    781.910.3694
Last modified: 12/31/1969 7:00 PM