how do I insert html in textarea

Posted on 2004-11-18
Last Modified: 2009-07-29

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 another that the user can click the links...

How do I achieve this..

Question by:smrlnarisetty
    LVL 23

    Accepted Solution

    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>

    Author Comment

    it displays fonts and bold letters ..but i need clickable links in it ?
    LVL 23

    Expert Comment


    i got the answer from the above:

    /* Links script
       (c) 2000 Michel Plungjan */
    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;


    Dont ask me what it means, i thought it might help
    LVL 13

    Assisted Solution

    use html editor (WYSIWYG)
    LVL 23

    Expert Comment

    grade C, what did we do wrong? oh well, thanks anyway for the points :o)

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
    I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now