Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2005
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Working with the document.write function

    In this code
    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.

  • #2
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    document.write <hr>

  • #3
    New Coder
    Join Date
    Mar 2005
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    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
    <body>
    <table blah blah>

    instead of

    <body><table blah blah>

    Thanks again!

  • #4
    Senior Coder
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    1,063
    Thanks
    2
    Thanked 0 Times in 0 Posts
    you add \n
    code+="htmlstuff\n"
    Shawn


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •