| | |
problem with <br> tag inside <textarea> tag???
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
I have written some code for template generator but I am having issue getting the formatting when it is generated in the <textarea></textarea>.
I want to have it to look like
Service Affected: {then populated text}
Service Status: {again populated text}
Current/Next Actions: {populated text}
it ends up printing out the <br>
Service Impacted: data<br />Service Status : lost comms<brNext Action : carrier invest<br>
here is the code I have written.
I want to have it to look like
Service Affected: {then populated text}
Service Status: {again populated text}
Current/Next Actions: {populated text}
it ends up printing out the <br>
Service Impacted: data<br />Service Status : lost comms<brNext Action : carrier invest<br>
here is the code I have written.
html Syntax (Toggle Plain Text)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script language="JavaScript"> function generate() { var sms = '' var impact = document.sms.impacted.value; var status = document.sms.status.value; var action = document.sms.action.value; var BR = '<br>' sms = sms + '<textarea name="template" rows="10" cols="55">'; sms = sms + 'Service Impacted: '+ impact + '<br />'; sms = sms + 'Service Status : '+ status + '<br>'; sms = sms + 'Next Action : '+ action +'<br>'; sms = sms + '</textarea>'; document.getElementById('sms').innerHTML=sms; //document.getElementById('blank').innerHTML=''; } </script> <link href="scripts/imt.css" rel="stylesheet" type="text/css" /> </head> <body> <script type="text/javascript"> <!-- --> </script> <div id="page"> <div id="wrapper"> <div id="header"></div> <div id="topSpacer"></div> <div id="body"> <h2 align="center">The Fault logging assistant</h2> <h3 align="center"></h3> <form name="sms" action=""> <table name="table" width="500" border="0" align="center"> <tr align="center"> <td colspan="2"> <h3>SMS Template Genterator</h3> </td> </tr> <tr> <td><strong>Service Impacted: </strong></td> <td> <input type="text" name="impacted" value=""> </td> </tr> <tr> <td><strong>Service Status: </strong></td> <td> <input type="text" name="status" value=""> </td> </tr> <tr> <td><strong>Next Action: </strong></td> <td> <input type="text" name="action" value=""> </td> </tr> <td><input type="button" name="button" value="Generate" onClick="generate()"> <tr> </tr> <tr> <td colspan="2"> <span id='sms'></span> </td> </tr> </table> <span id="blank"></span> </form> </div> <div id="bottomSpacer"></div> <div id="footer"> </div> </div> </div> </body> </html>
Last edited by leviathan185; Aug 26th, 2009 at 9:32 am. Reason: remove personal info
@ I'm gonna live forever, or die trying.
@ A wise man once told me, in order to understand recursion, you first must understand recursion.
@ A wise man once told me, in order to understand recursion, you first must understand recursion.
Hi,
try to re-apply few changes over lines':
hope it helps...
try to re-apply few changes over lines':
<script type="text/javascript">
// <![CDATA[
function generate()
{
var sms = ''
var impact = document.sms.impacted.value;
var status = document.sms.status.value;
var action = document.sms.action.value;
var BR = '\n';
sms = sms + '<textarea name="template" rows="10" cols="55">';
sms = sms + 'Service Impacted: '+ impact + BR;
sms = sms + 'Service Status : '+ status + BR;
sms = sms + 'Next Action : '+ action + BR;
sms = sms + '</textarea>';
document.getElementById('sms').innerHTML=sms;
//document.getElementById('blank').innerHTML='';
}
// ]]>
</script>hope it helps...
Dev.Opera — FOLLOW THE STANDARDS, BREAK THE RULES...
•
•
•
•
Hi,
try to re-apply few changes over lines':
<script type="text/javascript"> // <![CDATA[ function generate() { var sms = '' var impact = document.sms.impacted.value; var status = document.sms.status.value; var action = document.sms.action.value; var BR = '\n'; sms = sms + '<textarea name="template" rows="10" cols="55">'; sms = sms + 'Service Impacted: '+ impact + BR; sms = sms + 'Service Status : '+ status + BR; sms = sms + 'Next Action : '+ action + BR; sms = sms + '</textarea>'; document.getElementById('sms').innerHTML=sms; //document.getElementById('blank').innerHTML=''; } // ]]> </script>
hope it helps...
It works! thank you so much you are a legend!
@ I'm gonna live forever, or die trying.
@ A wise man once told me, in order to understand recursion, you first must understand recursion.
@ A wise man once told me, in order to understand recursion, you first must understand recursion.
![]() |
Similar Threads
- make a link from an array variable (PHP)
- RSS Feeds Tag Generation (RSS, Web Services and SOAP)
- tag id after ajax call not visible by js (JavaScript / DHTML / AJAX)
- to select a string from textarea (JavaScript / DHTML / AJAX)
- Omitting tag in a XML files (C++)
- xhtml-javascript taxtarea problem (JavaScript / DHTML / AJAX)
- Custom input tag? (JavaScript / DHTML / AJAX)
- can i retrieve the break tag from querystring? (HTML and CSS)
- how to validate checkbox with different names? (HTML and CSS)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Need a DIV always at bootm by my way!
- Next Thread: Problem with pop up on my javascript
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate array automatically beta box browser bug calendar captchaformproblem cart checkbox close codes column createrange() css cursor date debugger decimal dependent design dom download dropdown element embed enter error events firefox focus form frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 iframe images index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsfile jsp libcurl listbox maps masterpage media menu microsoft mimic mp4 onmouseover paypal php player position post problem programming progressbar prototype redirect regex runtime safari scale scriptlets search security select size software sql text textarea unicode w3c website window windowofwords windowsxp





