How can textarea's text with return

Discussion in 'ASP General' started by Jack, Feb 2, 2004.

  1. Jack

    Jack Guest

    Hello,
    <%@ Language=VBScript %>
    <%
    Response.Write "<FORM name=form1>"
    Response.Write "<TEXTAREA rows=2 cols=20 id=textarea1
    name=textarea1></TEXTAREA>"
    %>
    <Script language=JavaScript>
    document.form1.textarea1.value="ABC"&chr(13)&"DEF"
    </Script>
    <%
    Response.Write "</FORM>"
    %>
    I want textarea1 shows:
    ABC
    DEF
    But textarea1 shows none.
    Thank you
     
    Jack, Feb 2, 2004
    #1
    1. Advertising

  2. try \n instead of chr(13).

    <FORM name=form1>
    <TEXTAREA rows=2 cols=20 id=textarea1 name=textarea1></TEXTAREA>
    <Script language=JavaScript>
    document.form1.textarea1.value="ABC\nDEF"
    </Script>
    </FORM>

    The reason for this is because you are processing the JS outside the ASP script.

    Hope this helps.

    Stu

    "Jack" <> wrote in message news:#...
    > Hello,
    > <%@ Language=VBScript %>
    > <%
    > Response.Write "<FORM name=form1>"
    > Response.Write "<TEXTAREA rows=2 cols=20 id=textarea1
    > name=textarea1></TEXTAREA>"
    > %>
    > <Script language=JavaScript>
    > document.form1.textarea1.value="ABC"&chr(13)&"DEF"
    > </Script>
    > <%
    > Response.Write "</FORM>"
    > %>
    > I want textarea1 shows:
    > ABC
    > DEF
    > But textarea1 shows none.
    > Thank you
    >
    >
     
    Stuart Palmer, Feb 2, 2004
    #2
    1. Advertising

  3. Jack

    Jack Guest

    Thank you very much!
     
    Jack, Feb 2, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Greenhorn
    Replies:
    15
    Views:
    885
    Keith Thompson
    Mar 6, 2005
  2. Augustus
    Replies:
    1
    Views:
    400
    Ken Schaefer
    Sep 10, 2003
  3. Jack
    Replies:
    9
    Views:
    129
  4. Textarea Inside of a textarea

    , Feb 4, 2006, in forum: ASP General
    Replies:
    6
    Views:
    364
    Anthony Jones
    Feb 5, 2006
  5. Replies:
    1
    Views:
    359
    Bart Van der Donck
    Jul 4, 2007
Loading...

Share This Page