| Author |  | 
      
        | krommetje Super User
 
  
  
 Joined: December 29 2004
 Location: Netherlands
 Online Status: Offline
 Posts: 695
 | 
          Hi all
           | Posted: August 10 2007 at 05:44 | IP Logged |   |  
           | 
 |  
 suppose I have a form on a webpage with a button and I wanted to change the colour of the button according to the status of the device assigned to the button... how would I do this?
 
 (red for OFF bue for ON)
 
 Like so?
 
 <% if( [X10STATK4] = 1, <input type="submit" value="Voordeur Rolluik Open" style="color: "blue";  font-style: normal; font-family: verdana; font-weight: normal; font-size:16px; background-color: #99ccff"> , <input type="submit" value="Voordeur Rolluik Open" style="color: "Red";  font-style: normal; font-family: verdana; font-weight: normal; font-size:16px; background-color: #99ccff"> ) %>
 
 Peter
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | TonyNo Moderator Group
 
  
  
 Joined: December 05 2001
 Location: United States
 Online Status: Offline
 Posts: 2889
 | 
          Try this...
           | Posted: August 10 2007 at 08:01 | IP Logged |   |  
           | 
 |  
 
 
| Code: 
 
    
    | 
      
       | <input type="submit" value="Voordeur Rolluik Open" style="color: <% if( [X10STATK4] = 1, 'blue', 'red') %>"; font-style: normal; font-family: verdana; font-weight: normal; font-size:16px; background-color: #99ccff"> |  |  |  | 
       
        | Back to Top |       | 
       
       
        |  | 
        | krommetje Super User
 
  
  
 Joined: December 29 2004
 Location: Netherlands
 Online Status: Offline
 Posts: 695
 | 
          Hey that is neat, thanx TonyNo
           | Posted: August 13 2007 at 09:20 | IP Logged |   |  
           | 
 |  
 what if I wanted to change the color of the text as well? it seems this doesn't work when I try this:
 
 
 
| Code: 
 
    
    | 
      
       | <form method="get" action="/ph-cgi/playmacro">
 <input type="hidden" name="id" value="EETKAMERLAMP AAN">
 <input type="hidden" name="nexturl" value="/test.psp">
 <input type="submit" value="EETKAMERLAMP AAN" style="color: <% if( [X10STATK2] = 1, 'Black', 'Yellow') %>"; font-style: normal; font-family: verdana; font-weight: normal; font-size:16px; background-color: <% if( [X10STATK2] = 1, 'White', 'blue') %>">
 </form>
 
 |  |  |  
 The text changes but the background doesn't...
 
 Peter
 
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | TonyNo Moderator Group
 
  
  
 Joined: December 05 2001
 Location: United States
 Online Status: Offline
 Posts: 2889
 | 
          If it's a button, you can't change the BG color, AFAIK.
           | Posted: August 13 2007 at 13:29 | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |       | 
       
       
        |  | 
        | krommetje Super User
 
  
  
 Joined: December 29 2004
 Location: Netherlands
 Online Status: Offline
 Posts: 695
 | 
          If I am not mistaken this piece of code does:
           | Posted: August 15 2007 at 08:35 | IP Logged |   |  
           | 
 |  
 
 
| Code: 
 
    
    | 
      
       | <input type="submit" value="Voordeurrolluik Dicht" style="color: #003366;  font-style: normal; font-family: verdana; font-weight: normal; font-size:16px; background-color: <% if( [X10STATK4] = 1, 'blue', 'red') %>">
 
 |  |  |  
 But I can only change the colour OR the FontColour not both..I would like to though...
 
 Peter
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | TonyNo Moderator Group
 
  
  
 Joined: December 05 2001
 Location: United States
 Online Status: Offline
 Posts: 2889
 | 
          Well, I'll be! You can change the button color.
           | Posted: August 15 2007 at 13:36 | IP Logged |   |  
           | 
 |  
 Ah ha! Your quotes are different.
 
 This should work...
 
 
 
| Code: 
 
    
    | 
      
       | <form method="get" action="/ph-cgi/playmacro"> <input type="hidden" name="id" value="EETKAMERLAMP AAN">
 <input type="hidden" name="nexturl" value="/test.psp">
 <input type="submit" value="EETKAMERLAMP AAN" style="color: <% if( [X10STATK2] = 1, 'Black', 'Yellow') %>; font-style: normal; font-family: verdana; font-weight: normal; font-size:16px; background-color: <% if( [X10STATK2] = 1, 'White', 'blue') %>">
 </form>
 |  |  |  
 | 
       
        | Back to Top |       | 
       
       
        |  | 
        | krommetje Super User
 
  
  
 Joined: December 29 2004
 Location: Netherlands
 Online Status: Offline
 Posts: 695
 | 
          if you were a girl I'd give you one right smack on the lips!
           | Posted: August 18 2007 at 02:33 | IP Logged |   |  
           | 
 |    
 Peter
 
 Edited by krommetje - August 18 2007 at 02:34
 | 
       
        | Back to Top |       | 
       
       
        |  |