View Full Version : Working with the document.write function

03-15-2005, 02:34 AM
In this code

<script language="JavaScript" type="text/javascript>
code = "<body>";
code += "<table border=&quot;1&quot; width=&quot;750&quot; height=&quot;383&quot;>";
code += "<tr height=&quot;17.5&quot;>";
code += "<td width=&quot;302&quot; height=&quot;1&quot; align=&quot;center&quot; valign=&quot;top&quot;><b>Title: </b>" + title + "<br><b>Author: </b>" + author + "</td>";
code += "<td valign=&quot;top&quot; rowspan=&quot;2&quot; height=&quot;377&quot;><u><b>Synopsis</b></u><font size=&quot;2&quot;>: " + synopsis + "</font>";
code += "<p>&nbsp;<p>&nbsp;<p>&nbsp;<p>&nbsp;<p>&nbsp;<p>&nbsp;<p align=&quot;center&quot;>";
code += "<img border=&quot;0&quot; src=&quot;http://users4.ev1.net/~java4jim/" + condition + "_small.jpg&quot;>";
code += "<p align=&quot;center&quot;>";
code += "<a href=&quot;http://users4.ev1.net/~java4jim/condition.htm&quot;>condition=" + condition + "</a></td>";
code += "</tr>";
code += "<tr height=&quot;17.5&quot;>";
code += "<td width=&quot;302&quot; height=&quot;320&quot; align=&quot;center&quot;>";
code += "<img border=&quot;0&quot; src=&quot;" + picture + "&quot;></td>";
code += "</tr>";
code += "</table>";
code += "<p>&nbsp;</p>";
code += "<p>Please click <a href=&quot;http://users4.ev1.net/~java4jim/condition.htm&quot;>here</a> to see our rating system for the";
code += "&nbsp;condition of books.</p>";
code += "<p>Happy Bidding</p>";
document.write("<form name='form1'><textarea name='code' rows='20' cols='70' readonly='readonly'>" + code + "</textarea></form>");

is there a way to create a line break between each "code" line. So that when it writes the value code in the textbox there are designated line spaces.

03-15-2005, 02:43 AM
document.write <hr>

03-15-2005, 02:50 AM
So where would i put the <hr>?
I'm pretty sure it wouldn't go like this

code = "<body><hr>"
code += "<table border=&quot;1&quot; width=&quot;750&quot; height=&quot;383&quot;>
document.write("<form name='form1'><textarea name='code' rows='20' cols='70' readonly='readonly'>" + code + "</textarea></form>");

would it?

Pretty much my goal with this script is to make the html inside the text area to be more readable ("The reason I don't just write it out in normal html is because I'm using this code in a new window)

Like I want it to display
<table blah blah>

instead of

<body><table blah blah>

Thanks again!

03-15-2005, 02:52 AM
you add \n

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum