Topic awaiting preservation: Using "RGB(###,###,###) with variables?? |
|
---|---|
Author | Thread |
Neurotic (0) Inmate Newly admitted From: |
posted 11-19-2004 21:39
Hi, i'm quite new to javascript, and I have this poblem which is bummy and annoying. |
Paranoid (IV) Inmate From: France |
posted 11-19-2004 21:44
[überQuickReply] code: parent.body.document.bgColor="rgb(redbox,greenbox,bluebox)"; by code: parent.body.document.bgColor="rgb("+redbox+","+greenbox+","+bluebox+")"; Hope that helps... |
Obsessive-Compulsive (I) Inmate From: |
posted 11-20-2004 16:17
Yeah that worked great, thanks |
Obsessive-Compulsive (I) Inmate From: |
posted 11-20-2004 17:51
Ok I have another problem |
Bipolar (III) Inmate From: Umeå, Sweden |
posted 11-20-2004 18:38
Cicatriz: Yes, it is possible. You'll have to do some math, though. What contrasting colour do you want - the inverse? The opposite hue at the same brightness? |
Obsessive-Compulsive (I) Inmate From: |
posted 11-21-2004 04:16
Yeah I want the opposite, so if the background was black the heading text would turn white. |
Bipolar (III) Inmate From: Umeå, Sweden |
posted 11-21-2004 04:21
Then you just take 255-r, 255-g and 255-g. Simple as that. The same brightness/opposite hue thing is more difficult. |
Obsessive-Compulsive (I) Inmate From: |
posted 11-21-2004 17:26
Ermmm, could you give me an example. I have |
Bipolar (III) Inmate From: Umeå, Sweden |
posted 11-21-2004 19:15
parent.body.document.bgColor="rgb("+(255-redbox)+","+(255-greenbox)+","+(255-bluebox)+")"; |
Paranoid (IV) Inmate From: France |
posted 11-21-2004 19:53
cicatriz: It'd be great if you tried some things by yourself before asking the solution. |
Obsessive-Compulsive (I) Inmate From: |
posted 11-21-2004 20:26
I did try it on my own, infact I spent several hours looking about on google before I finally decided to use a forum for your information |
Paranoid (IV) Inmate From: Madison, Indiana, USA |
posted 11-21-2004 21:34
cicatriz, code: parent.body.document.bgColor="rgb("+redbox+","+greenbox+","+bluebox+")";
|
Obsessive-Compulsive (I) Inmate From: |
posted 11-22-2004 14:02
ok thanks guys, thats a big help. |