Need help with arrays and spacing text in a selection box

Uber_Tiny

New member
Below is the code I am working on for work. For the life of me I can not figure out how to put a new line in the text.

Like so:

Thank you contacting us.

We are glad to blah bah blah.

Again thank you for contacting us and so on and so forth.


Code is below:
Code:
<html>
  <head>
    <title>Canned Messages of Doom</title>
    <script language="javascript" type="text/javascript">
      var canned    = new Array();
      var cannedtxt = new Array();
      
      canned[0]    = "Auto Responses"
      cannedtxt[0] = "[COLOR=Red]Thank you contacting us.

        We are glad to blah bah blah.

        Again thank you for contacting us and so on and so forth.[/COLOR]";
      
      canned[1]    = "Title 2"
      cannedtxt[1] = "Tacos";
      
      canned[2]    = "Title 3"
      cannedtxt[2] = "Nipples";
      
      function loader() {
        o = document.getElementById('selector');
        
        for (x=0; x < canned.length; x++) {
          o[o.length] = new Option(canned[x], x);
        }
      }
      
      function selector(x) {
        document.getElementById('textytext').value = cannedtxt[x];
      }
    </script>
  </head>
  <body onload="loader()">
  <center>
  <font size="12">Canned Reponses</font>
  <table border="1">
    <tr>
      <th>Script Selector</th>
      <th>Script</th>
    </tr>
    <tr>
      <td><select id="selector" size="20" onchange="selector(this.value)"></select></td>
      <td><textarea id="textytext" rows="20" cols="60" readonly="readonly"></textarea></td>
    </tr>
  </table>
  </center>
  </body>
</html>
If I keep it all together without hitting the enter button it all works, but that just isn't what I am after. It needs to be spaced out.

Any help is greatly appreciated.
 
Yes, i finally figured it out.

Code:
canned[0]    = "Auto Responses"
cannedtxt[0] = "[COLOR=Red]Thank you contacting us. \n\nWe are glad to blah bah blah.[/COLOR][COLOR=Red] [COLOR=Red]\n\n[/COLOR]Again thank you for contacting us and so on and so forth.[/COLOR]";
 
Yeah, I figured that one out a little later on.

It's \"text\"


It's javascript, so no unfortunately.
Ahh I see. I thought because it's rendering directly the text anyway " would render as ". Meh, I've never been very good with web stuff.
 
Back
Top