| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Changing color on a form field, dependent on value of the field
Hi all
I have a ASP page where i list and also update records stored in a database. I would like to change background color on the fields if the field has a certain value. Example: If the value in the <%=(Recordset1.Fields.Item("RecItem1").Value)%> is "x", i want the input field to turn red when I load the page. The code for the input fields look like this: <td nowrap><input name="txtField1" type="text" onChange="RecUpdate value="<%=(Recordset1.Fields.Item("RecItem1").Value)%>" size="4"></td> Any idea? Best regards /Bjorn |
|
#2
|
||||
|
||||
|
Make sure to dim recItem1Value and backg in the appropriate area
Try this: Code:
<%
recItem1Value = lcase(Recordset1.Fields.Item("RecItem1").Value)
backg = ""
Select Case recItem1Value
Case "x"
backg = " style=""background-color:red;"" "
Case Else
backg = ""
End Select
%>
<!-- whatever code here... //-->
<td<%=backg%> nowrap><input name="txtField1" type="text" onChange="RecUpdate value="<%=(Recordset1.Fields.Item("RecItem1").Value)%>" size="4"></td>
__________________
If you found a post of mine helpful, please click on the on my post to add to my reputation.
|
|
#3
|
|||
|
|||
|
Thanks :-D
Great thanks, it works
/B |
![]() |
| Viewing: ASP Free Forums > Web Design > Web Layout > Changing color on a form field, dependent on value of the field |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|