shteev
Programmer
- Jul 15, 2003
- 42
I'm writing a Jscript version of mastermind, code here:
http://mysite.wanadoo-members.co.uk/shteevshouse/games/MindMaster.html
I'm trying to fix it so that it works for Firefox as well as Opera and IE.
Each cell can be one of six colors. When I click on a colored cell, I want it's color to advance by 1 through the color sequence: red, green, blue, cyan, yellow, purple.
To do this I need to check the background color of the cell; but if I check <cell>.style.background different browsers return different values.
E.g. if i set a cell background color to 'red', and then check the value of <cell>.style.background,
IE will return 'red'
Opera will return '#ff0000'
Firefox will return 'rgb(255, 0, 0) none repeat scroll 0% 0%'
What functions can I use to ensure cross-browser functionality?
http://mysite.wanadoo-members.co.uk/shteevshouse/games/MindMaster.html
I'm trying to fix it so that it works for Firefox as well as Opera and IE.
Each cell can be one of six colors. When I click on a colored cell, I want it's color to advance by 1 through the color sequence: red, green, blue, cyan, yellow, purple.
To do this I need to check the background color of the cell; but if I check <cell>.style.background different browsers return different values.
E.g. if i set a cell background color to 'red', and then check the value of <cell>.style.background,
IE will return 'red'
Opera will return '#ff0000'
Firefox will return 'rgb(255, 0, 0) none repeat scroll 0% 0%'
What functions can I use to ensure cross-browser functionality?