Results 1 to 11 of 11

Thread: Changing textbox color

  1. #1

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    Changing textbox color

    Hi

    how do i change the color of my textbox via ASP?

    The code I have is
    VB Code:
    1. <tr>
    2.             <td class="formText">Weight Tolerance Plus</td>
    3.             <td>
    4.                 <input type="text" disabled name="weight_tolerance_plus" maxlength=10 size=20
    5.                 value='111' onChange="changeFont(this);">
    6.             </td>
    7.             <td nowrap class="formText">Maximum Pallet Weight</td>
    8.             <td>
    9.                 <input type="text" name="maximum_pallet_weight" maxlength=10 size=20
    10.                 value='735' onChange="changeFont(this);">
    11.             </td>
    12.           </tr>
    13.           <tr>

    Thanks
    ** HOLLY **

  2. #2
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Re: Changing textbox color

    Set its style.

    style="background-color: Red;"

  3. #3

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    Re: Changing textbox color

    Thanks for replying!

    You will have to excuse my ignorance but I'm new to ASP..so in my example
    where would you set its style?

    Thanks again
    ** HOLLY **

  4. #4
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Re: Changing textbox color

    Firstly are you using asp or asp.net?

  5. #5
    Fanatic Member Valleysboy1978's Avatar
    Join Date
    Nov 2004
    Location
    Planet Xeoroaniar CC Posts:1,928,453,459,361
    Posts
    770

    Re: Changing textbox color

    can you not set the background color to red in the text-box properties? or is the color going to change at some point?
    Life is one big rock tune

  6. #6

    Thread Starter
    Fanatic Member holly's Avatar
    Join Date
    Aug 2002
    Location
    Somewhere on earth
    Posts
    721

    Re: Changing textbox color

    I'm using ASP...I know I should of poted this in the other section

    Thanks
    ** HOLLY **

  7. #7
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Re: Changing textbox color

    I guess in asp you'd do it something like
    VB Code:
    1. 'Set to whatever colour you need
    2. dim strStyle = "background-color: Red;"
    3. '...
    4. <input type="text" style=<%=strStyle%>....

  8. #8
    Fanatic Member Valleysboy1978's Avatar
    Join Date
    Nov 2004
    Location
    Planet Xeoroaniar CC Posts:1,928,453,459,361
    Posts
    770

    Re: Changing textbox color

    or, you could use:
    Code:
    style="color:Red"
    Life is one big rock tune

  9. #9
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Re: Changing textbox color

    Quote Originally Posted by Valleysboy1978
    or, you could use:
    Code:
    style="color:Red"
    Although that will change the colour of the text rather than the textbox itself.

  10. #10
    Fanatic Member Valleysboy1978's Avatar
    Join Date
    Nov 2004
    Location
    Planet Xeoroaniar CC Posts:1,928,453,459,361
    Posts
    770

    Re: Changing textbox color

    I know. Wasn't sure what she was asking for as she only asked how to change the color of the textbox, thought I'd include the text color too.

    Holly, in the end, the best way to go about this is the CSS route.
    Good luck
    Life is one big rock tune

  11. #11
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Changing textbox color

    style="background-color:red;"

Posting Permissions

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



Click Here to Expand Forum to Full Width