...

View Full Version : documen.write problem



bacterozoid
06-22-2002, 09:48 PM
Ok, I went here:

http://www.simonsgroup.com/test/html2javascript/html2javascript.html

and put some coding in to be converted, and it gave me some stuff I don't understand:


var code="javascript here";

I have always used document.write('stuff here'); for my external JS files. What is the difference?

joh6nn
06-22-2002, 10:07 PM
nothing.

whammy
06-22-2002, 10:09 PM
Basically all that script is doing for you is converting your HTML or text string into a javascript variable, and then using document.write() to write it out for you.

ACJavascript
06-22-2002, 11:29 PM
Whammy is 100% right.

Example

you normally put (as you said)

say : document.write("<html><head><title>DD</title></head>")

all there doing is putting the <html><head> ect. into a javascript variable

like: var code="<html><head><title>DD</title></head>"

then there putting it into the document.write

as: document.write(code)

by doing that you can cut down on space & its alot neater.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum