• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 187
  • Last Modified:

how do I insert html in textarea

Hi,

My requirement is to insert HTML text in a textarea in one form[it could contain <a href...>cc</a>....<b>..</b> etc] and to be able parse the HTML and show the links in another textarea..in another form...so that the user can click the links...

How do I achieve this..

Thanks
Ram.
0
smrlnarisetty
Asked:
smrlnarisetty
  • 3
2 Solutions
 
aprestoCommented:
try this - i got it from another thread:

<DIV ID="chip1" contentEditable=true STYLE="LEFT: 134px; OVERFLOW: scroll; WIDTH: 188px; BORDER-TOP-STYLE: inset; BORDER-RIGHT-STYLE: inset; BORDER-LEFT-STYLE: inset; POSITION: absolute; TOP: 75px; HEIGHT: 125px; BORDER-BOTTOM-STYLE: inset">
<b> hello</b> <Font size="5" color=red>Hellllllllooooo  Again!</font>
</DIV>
0
 
smrlnarisettyAuthor Commented:
it displays fonts and bold letters ..but i need clickable links in it ?
0
 
aprestoCommented:
http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_11827220.html?query=%3Ca+href%3E+in+textarea&clearTAFilter=true

i got the answer from the above:

<script>
/* Links script
   (c) 2000 Michel Plungjan michel@irt.org */
function translate() {
   text = document.myForm.myArea.value

   newText = "";
   if (text.indexOf('link:') !=-1) {
      myLinks = text.split('link:')
      for (i=0;i<myLinks.length;i++) {
         if (myLinks[i]) newText += myLinks[i] +
         '\n<a href="' + prompt('href for >'+myLinks[i]+'< ?','href="http://">http://') + '">' + prompt('text for >'+myLinks[i]+'< ?',myLinks[i])+'</a>';
      }
      text = newText;
   }
   else newText = text;
   alert(text);
}

</script>

Dont ask me what it means, i thought it might help
0
 
nurbekCommented:
use html editor (WYSIWYG)

http://www.htmlarea.com/
0
 
aprestoCommented:
grade C, what did we do wrong? oh well, thanks anyway for the points :o)
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now