Click here to Skip to main content
15,920,110 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: Javascript Form Function Help Needed Pin
angelina_jolie9-May-05 22:11
angelina_jolie9-May-05 22:11 
GeneralRe: Javascript Form Function Help Needed Pin
DavidNohejl10-May-05 0:01
DavidNohejl10-May-05 0:01 
GeneralRe: Javascript Form Function Help Needed Pin
Yulianto.10-May-05 17:00
Yulianto.10-May-05 17:00 
GeneralDetermining the size of the pop window Pin
govann8-May-05 23:17
govann8-May-05 23:17 
GeneralRe: Determining the size of the pop window Pin
JKroschel9-May-05 6:01
JKroschel9-May-05 6:01 
GeneralFlash game in 4 days help Pin
monageasmear8-May-05 0:24
monageasmear8-May-05 0:24 
GeneralRe: Flash game in 4 days help Pin
MoustafaS9-May-05 9:43
MoustafaS9-May-05 9:43 
Generalreatime format/parse of <TEXTAREA> in JScript Pin
scorpion6666-May-05 12:53
scorpion6666-May-05 12:53 
Hi,
Basically I'm trying to grab the value of a textarea.innerHTML and spit it out elsewhere in the page using what HTML tags have been used in the textarea. This works fine, what I need is help finding a newline character in the <textarea> on the fly, to parse this into the 'preview' pane. Below is a sample of what I'm trying to get at, ANY help will be MUCH appreciated.
Thanks guys!


<HTML>
<SCRIPT>
function changePreview(demo, source){
var buffer = source.value;

buffer = buffer.replace(/\[B]/ig, "<B>");
buffer = buffer.replace(/\[\/B]/ig, "</B>");

buffer = buffer.replace(/\[I]/ig, "<I>");
buffer = buffer.replace(/\[\/I]/ig, "</I>");

buffer = buffer.replace(/\[U]/ig, "<U>");
buffer = buffer.replace(/\[\/U]/ig, "</U>");

//buffer = buffer.replace(chr(10), "<BR>"); **I know I need something like this, but get JS errors

document.getElementById(demo).innerHTML = buffer;
}

</SCRIPT>
<BODY>


<form method=post action="index.htm" name="post">

<textarea name="message" cols=100 rows=20
onkeyup='changePreview("preview", this);'
onclick='changePreview("preview", this);'
onchange='changePreview("preview", this);'
onselect='changePreview("preview", this);'>
Bio Hazzard</textarea><input type=submit value=Update!></form>

<BR><BR>
Below is the 'preview' pane<BR><HR><BR>
<div id="preview"> </div>

</BODY></HTML>
GeneralAllwebMenus Pin
Alice-fido6-May-05 8:29
sussAlice-fido6-May-05 8:29 
GeneralNesting divs Pin
benjymous6-May-05 2:16
benjymous6-May-05 2:16 
General&lt;li&gt; Tag Pin
Bassam Abdul-Baki6-May-05 2:11
professionalBassam Abdul-Baki6-May-05 2:11 
GeneralCustom DataGrid Pin
soundappan6-May-05 0:25
soundappan6-May-05 0:25 
Generalhelp me... Pin
Mahesh16795-May-05 21:06
Mahesh16795-May-05 21:06 
GeneralRe: help me... Pin
Dan_P5-May-05 23:09
Dan_P5-May-05 23:09 
GeneralRe: help me... Pin
JKroschel9-May-05 6:39
JKroschel9-May-05 6:39 
GeneralWeb service Pin
skrishnasarma5-May-05 17:59
skrishnasarma5-May-05 17:59 
GeneralASP web sites on an XP box Pin
paixtis5-May-05 4:16
paixtis5-May-05 4:16 
GeneralRe: ASP web sites on an XP box Pin
ddesi161276-May-05 13:04
ddesi161276-May-05 13:04 
GeneralRe: ASP web sites on an XP box Pin
JKroschel9-May-05 6:07
JKroschel9-May-05 6:07 
QuestionHTML Text box recommendations, anyone? Pin
NeverHeardOfMe5-May-05 0:29
NeverHeardOfMe5-May-05 0:29 
AnswerRe: HTML Text box recommendations, anyone? Pin
Anonymous5-May-05 13:52
Anonymous5-May-05 13:52 
GeneralReference to Files Pin
Grahamfff4-May-05 10:44
Grahamfff4-May-05 10:44 
GeneralRe: Reference to Files Pin
Anonymous5-May-05 15:38
Anonymous5-May-05 15:38 
Generalalternative to javascript Pin
brian554-May-05 9:46
brian554-May-05 9:46 
GeneralRe: alternative to javascript Pin
Scott Serl4-May-05 20:51
Scott Serl4-May-05 20:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.