dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

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
    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