Author |
|
krommetje Super User
Joined: December 29 2004 Location: Netherlands
Online Status: Offline Posts: 695
|
Posted: August 10 2007 at 05:44 | IP Logged
|
|
|
Hi all
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
|
Posted: August 10 2007 at 08:01 | IP Logged
|
|
|
Try this...
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
|
Posted: August 13 2007 at 09:20 | IP Logged
|
|
|
Hey that is neat, thanx TonyNo
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
|
Posted: August 13 2007 at 13:29 | IP Logged
|
|
|
If it's a button, you can't change the BG color, AFAIK.
|
Back to Top |
|
|
krommetje Super User
Joined: December 29 2004 Location: Netherlands
Online Status: Offline Posts: 695
|
Posted: August 15 2007 at 08:35 | IP Logged
|
|
|
If I am not mistaken this piece of code does:
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
|
Posted: August 15 2007 at 13:36 | IP Logged
|
|
|
Well, I'll be! You can change the button color.
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
|
Posted: August 18 2007 at 02:33 | IP Logged
|
|
|
if you were a girl I'd give you one right smack on the lips!
Peter
Edited by krommetje - August 18 2007 at 02:34
|
Back to Top |
|
|