JavaScript - Variables and Document.write
Insert the below into the <head> section of
your page
Insert the below into the <body> section of your page
Description
Using the above JavaScript you can specify text to be used
throughout your page by just writing it once then have it re-wrote on your page
using document.write and specifying the variable(s) to be used. See
example highlighted in yellow above.
Variables
A variable can be defined as a number or a piece of
text, and you can use the variable value throughout your script.
You just need to declare the variable's name and value.
Note:- Variable names in JavaScript are case
sensitive and They must begin with a letter or the underscore
character _
document.write()
Download