www.webdeveloper.com
Results 1 to 4 of 4

Thread: Display Style Inside a Text Area

  1. #1
    Join Date
    Jul 2005
    Posts
    4

    Question Display Style Inside a Text Area

    Hi there,
    Does anyone know of a way that i can display styled text within a text area/box?

    say i wanted to write something like this..

    <text area>
    I am <span class="style1> tearing </span>
    my hair out over this <span class="style2">Project</span>
    </text>

    The text does not get displayed in the relevant styles and all the text gets written to the page.

    Anyone know of a workaround to this?

    Thanks

    Ally

  2. #2
    Join Date
    Jul 2005
    Location
    India
    Posts
    145
    use this code




    <html>
    <head>
    <SCRIPT LANGUAGE="JavaScript"><!-- This script and many more are available free online at -->
    function insertText(){
    document.frm.document.write("<b>This is</a><font color='red'>Test </font>!");

    //alert();
    }
    </script>
    </head>

    <body onload="insertText()">
    <iframe id="frm" name="frm"></iframe>

    </body></html>

  3. #3
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,972
    It seems you can't put markup into a textarea or input field. But you could always make something look like a text area.
    HTML Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
     "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>This is not a text box.</title>
    <style type="text/css">
    <!--
    div.boxlike{
    border: 3px inset #fff;
    padding: 5px;
    width: 300px;
    font-family: monospace;
    }
    div.boxlike p{
    padding: 0;
    margin: 0;
    }
    em.mega{
    color: #f00;
    }
    -->
    </style>
    </head>
    <body>
    <div class="boxlike">
    <p>This is <em>not</em> a text box.</p>
    <p>No really, it <em class="mega">isn't</em>.</p>
    </div>
    </body>
    </html>
    Disclaimer. (1) Whilst I will help you sometimes, if I feel like it, and my advice in relation to your actual question will be of good quality: my posts are to be taken with a pinch of salt. I will be sarcastic, deploy irony and include obscure cultural references for my own amusement without warning.
    (2) You will gain nothing from complaining, and if you try to argue with me then you will not win. No matter how noble your battle seems, I am still better than you, don't be an hero.

  4. #4
    Join Date
    Jul 2005
    Posts
    4
    Thats cool deep, but i need to be able to edit the text that is written aswell.. That was why i was using a text area..

    I have tried writing to cells of tables, although that works, i then cannot edit the text and save it again.

    Do you have any other ideas??

    Thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles