sypher
10-16-2003, 12:53 AM
I want my textbox for th forums I wrote to work like these where if you enter a
line break, it shows up. How would I go about this?
line break, it shows up. How would I go about this?
|
Click to See Complete Forum and Search --> : Forum Help sypher 10-16-2003, 12:53 AM I want my textbox for th forums I wrote to work like these where if you enter a line break, it shows up. How would I go about this? Khalid Ali 10-16-2003, 02:01 AM Code snippet below should work... <script type="text/javascript"> <!-- function Process(){ var frm = document.getElementById("form1"); var len = frm.length; var textarea = document.getElementById("tarea"); var value = textarea.value.replace(/\n/gi,"<br/>"); document.getElementById("data").innerHTML = value; } //--> </script> </head> <body > <form id="form1" action="" onsubmit=""> <input type="text" name="t1"/><br/> <textarea id="tarea"></textarea> <input type="button" value="process" onclick="Process()"/> </form> <div id="data" style="width:200px; height:200px;border:1px solid orange;"></div> sypher 10-16-2003, 02:40 AM I dont think that's going to work for me since I coded the page in coldfusion, but I'm fiddling with it nonetheless. Thanks Khalid Ali 10-16-2003, 07:49 AM according to your question,it will work,of course if there is something else that you did not mention then its possible that it won't work ;) sypher 10-16-2003, 10:06 AM Yes I just read my initial post and it's not worded very well, I apologize for that. What I meant was that the text boxt will not recognize if you hit enter. It will keep the text on the same line. It's a formating issue, where if you wanted to say have a 3 paragraph post that looked like this: Hello, would you like to play a game? sentance 2. sentance 3 sentance 4 Hello, would you like to play a game? sentance 2. sentance 3 sentance 4 Hello, would you like to play a game? sentance 2. sentance 3 sentance 4 It would show up like this: Hello, would you like to play a game? sentance 2. sentance 3 sentance 4Hello, would you like to play a game? sentance 2. sentance 3 sentance 4Hello, would you like to play a game? sentance 2. sentance 3 sentance 4 Unless you were to type in <br> after each paragraph. So I need the form to recognize that when a user hits enter that it's signifying a line break when it stores the post. Hope that clears it up for you and sorry about the messiness :( webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |