[Javascript] document.write from a global variable.
Flavio Gomes
flavio at economisa.com.br
Mon Sep 6 07:40:05 CDT 2004
> I don't know what you are talking about here.. javascript is
> interpreted along with html.. Exactly on the place after an html tag
> where you have included a document.write() statement, the html code
> will be dynamically included. A second document.write() will simply be
> appended to the rest of the html code... And that's just the way it is..
This will append my_variable to the the code:
<script language="JavaScript">
var my_variable = "There's some kind of content here.";
document.write(my_variable);
</script>
This will overwrite all you document code:
<script language="JavaScript">
setTimeout("document.write(my_variable);", 2000);
</script>
document.write will only overwrite the document when it's already
loaded. ("onload=document.write" will append to the end)
--
Flavio Gomes
flavio at economisa.com.br
More information about the Javascript
mailing list