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 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Going to the next line when setting a textarea's value using Jscript

    Hey all, thanks for at least checking out my thread.

    Now what I want to know is when setting a textarea's value using Javascript, how do you 'Go to the next line'? I have tried '<br>' and obviously it didn't work, and I now realise how very stupid it was to even try it, anyway, if it helps this is the code I am using . . .

    Code:
     
     <HEAD>
    
     <SCRIPT LANGUAGE="JavaScript">
     <!--
    var line = "First Line" 
    var secondLine = "Second Line"
    
    function writing() {
    	line += secondLine
                 document.psword.txtarea.value = line
    	
    }
     //-->
      </SCRIPT>
    
     </HEAD>
     
     <BODY>
      <FORM NAME="psword">
        <textarea name="txtarea" cols="70" rows="30"></textarea>
     </FORM>
    
    
     <SCRIPT LANGUAGE="JavaScript">
     <!--
    writing()
    //-->
      </SCRIPT>
     
    
     </BODY>

  • #2
    Senior Coder
    Join Date
    Feb 2003
    Posts
    1,665
    Thanks
    0
    Thanked 27 Times in 25 Posts
    e.g.
    Code:
    function writing() {
    	line += "\n" + secondLine
    	document.psword.txtarea.value = line;
    }
    Last edited by Bill Posters; 10-18-2005 at 12:09 PM.

  • #3
    New Coder
    Join Date
    Sep 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post

    Thank you so very very much Bill Posters! It's so great to have this forum. I am not much for Javascript knowledge, but if there is anything I can do to assist you in any of your projects, please let me know. Thank you!


  •  

    Posting Permissions

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