NEED HELP ASAP please please

Discussion in 'Blogging' started by Marielle, Apr 13, 2010.

  1. Marielle

    Marielle Newbie

    Joined:
    Nov 12, 2009
    Messages:
    28
    Likes Received:
    0
    Hello people, i would like to ask what is the html code for a text box, where the users can copy and paste the code i post. Here is just what i tested : http://top10jokesinhistory.blogspot.com/2010/04/testing.html


    what i want to have is a text box that when the user clicks inside it, the code will be highlighted (all of it) with just one click because the code is long.

    Thank you!


    Oh and I want the this text box be exactly like this: [​IMG]

    When you click in the text the box ithe whole code will be highlighted, how can i do that?
     
    Last edited: Apr 13, 2010
  2. trapmuzik

    trapmuzik Junior Member

    Joined:
    Mar 20, 2009
    Messages:
    192
    Likes Received:
    22
    you need javascript code to do that. Try this:

    Code:
    <script type="text/javascript">
    function SelectAll(id)
    {
        document.getElementById(id).focus();
        document.getElementById(id).select();
    }
    </script>
    
    Textarea:<br>
    <textarea rows="3" id="txtarea" onClick="SelectAll('txtarea');" style="width:200px" >This text you can select all by clicking here </textarea>
    
    Input TextBox:<br>
    <input type="text" id="txtfld" onClick="SelectAll('txtfld');" style="width:200px" value = "This text you can select all" />