Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace ' ' with <br>

Status
Not open for further replies.

vasilek

Programmer
Jan 5, 2003
99
US
Here is a string.

value1 value2 value3

How to display the values on the webpage with <br> in between?

value1
value2
value3

Thanks.
 
Maybe something like
value1+&quot;<BR>&quot;+value2+&quot;<BR>&quot;+value3


I have this little thing, Advanced Delusionary Schizophrenia with Involuntary Narcissistic Rage. It's no big deal really...
 
GUJUm0deL, it has to be dynamic, may be utilizing String.replace()
 
Here's an example using replace:
Code:
<html><head><script language=&quot;JavaScript&quot;>
var resp = /\s/g;
var str = 'val1 val2 val3 val4';
var pstr = str.replace(resp,'<br>');
document.write(pstr);
</script></head><body></body></html>

2b||!2b
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top