Click to See Complete Forum and Search --> : document.write


pyro
12-08-2002, 09:36 AM
Is there any way to put multiple lines of HTML in a document.write, or do you have to put the document.write command on every line? Basically, I have a .js file that needs a lot of HTML in it and would rather not have to put document.write before every line.

pyro
12-08-2002, 12:12 PM
I'm not exactly sure what you mean. Could you maybe give me some example code to explain what you are talking about?

Charles
12-08-2002, 03:16 PM
Or, if you prefer:

document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
'<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">',
'<title>',
'Some Page',
'</title>',
'<p>',
'<a href="',
'mypage.html',
'">',
'link text',
'</a>',
'</p>');

pyro
12-08-2002, 07:48 PM
Thanks. The second method is pretty close to what I'm looking for. It'll do. I wanted to make it as easy as possible to add HTML to the .js file. I wanted to be able to copy large amounts in and not have to do too much editing.