How to get line break and carriage return in text box to work on IE?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cyuno
    New Member
    • Aug 2010
    • 4

    #1

    How to get line break and carriage return in text box to work on IE?

    I am having problems in IE with the following text box javascript code. In Firefox the line breaks and carriage returns work perfectly but not in IE:

    Here is the javascript:
    Code:
    	function repp(){
    				var ss = document.getElementById('description').value;
    				ss = ss.replace(/(\r\n)|(\n)/g,"<br/>");
    				document.getElementbyId('description').value = ss;
    			}
    Here is the text box code:
    Code:
    <div id="description" name="text" style="font-family:Arial,Helvetica,sans-serif;font-size:18px;position:relative;top:100px;left:400px;color:navy;font-weight:bold;width:300px;height:300px;white-space:pre-wrap;word-wrap:break-word;_white-space:pre;" >
                                       
                                       
                                       
                                      
                                       </div>
    
    <td  width="400px" valign="top" onkeypress="repp();"><textarea id="message" name="message"  style="width:300px;height:100px;" onblur="javascript:process_input();" onkeypress="return ismaxlength(this)" class="content" onkeyup="checkTaLength(this, 'charcount01', 'remaining01', 1000);" onkeydown="checkTaLength(this, 'charcount01', 'remaining01', 1000);" onmouseout="checkTaLength(this, 'charcount01', 'remaining01', 1000);" onfocus="checkTaLength(this, 'charcount01', 'remaining01', 1000);" ></textarea><br/><span style="font-size:11px; color:#CC0000"><span id="charcount01">0</span> characters entered.   |   <span id="remaining01">1000</span> (of 1000) characters remaining.</span></td>
Working...