www.webdeveloper.com
Results 1 to 5 of 5

Thread: input colored text?

  1. #1
    Join Date
    Aug 2005
    Posts
    35

    input colored text (BOLD)?

    hello all,

    i need a script prompting a user for choice of color (red, blue, green) and then when text is entered into a textbox it is displayed in that color,
    (and also BOLD)

    thanks john
    Last edited by jwisneski2003; 09-08-2005 at 12:12 AM. Reason: whoops forgot BOLD TEXT

  2. #2
    Join Date
    Apr 2005
    Location
    Bathurst, NSW, Australia
    Posts
    3,357
    Code:
    <html>
    <head>
    <title>Untitled Document</title>
    </head>
    
    <body>
    <script type="text/javascript">
    function doit(selection){
    var color = selection.value;
    document.getElementById('input').style.color = color;
    }
    </script>
    <form name="form1" method="post" action="">
      <p> 
        <label> 
        <input type="radio" name="RadioGroup1" value="#f00" onChange="doit(this);">
        Red</label>
        <br>
        <label> 
        <input type="radio" name="RadioGroup1" value="#0f0" onChange="doit(this);">
        Green</label>
        <br>
        <label> 
        <input type="radio" name="RadioGroup1" value="#00f" onChange="doit(this);">
        Blue</label>
        <br>
        <input name="text" type="text" id="input">
      </p>
    </form>
    </body>
    </html>

  3. #3
    Join Date
    Jan 2005
    Posts
    386
    If the input text has to be bold all the time, you can use this (for ex) in the <head>:
    Code:
    <style>
    .my_input {
      font-family: cursive;
      font-weight: 900;
      font-size: 12pt;
    }
    </style>
    and then in the <body>:

    Code:
        <input name="text" type="text" id="input" class="my_input">
    This orange ad for MacroMedia Studio 8 is the ugliest thing I've ever seen.

  4. #4
    Join Date
    Sep 2005
    Posts
    180
    <html>
    <head>
    </head>
    <body bgcolor="#aaffbb" text="black">
    <pre>
    c:\web\jtest54.htm.htm Thursdae 08 Sep 05 at 0815
    select radio button tu set koler av input text
    <script language="JavaScript">
    <!-- ******************* java skripts **************
    //*
    //************** setkoler
    function setkoler(instring){
    //****** chaenj text koler av input text area
    document.inputf.intext1.style.color=instring;
    return true
    }
    //******** bottom av setkoler
    // -->
    </script>
    <!******************** html ********************>
    <form name="inputf">
    select the koler for text input
    <input type="radio" value="red" name="chek1"
    onMousedown="setkoler('red')">red
    <input type="radio" value="blue" name="chek1"
    onMousedown="setkoler('blue')">blue
    <input type="radio" value="green" name="chek1"
    onMousedown="setkoler('green')">green
    <!******>
    input text heer
    <textarea name="intext1" colms=60 rows=6
    style="font-weight:bold">
    start stuff</textarea>
    <!******>
    <input type=text value="submit" size=8
    style="cursorointer;cursor:hand"
    onClick="gettext(document.inputf)">
    </form>
    </body>
    </html>

  5. #5
    Join Date
    Apr 2005
    Location
    Bathurst, NSW, Australia
    Posts
    3,357

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