PDA

View Full Version : <list> box color change possible?


naray
01-20-2009, 10:09 AM
Hi all , i have some questions in implementing the <list></list> box
on mouse track over and out i can able to change the colors of the list item
but i want to change the color of list in to three different colors i.e
say for example there are 6 items
1. aaa
2. bbb
3. aaa
4. ccc
5. ddd
6. aaa from my datapath

i want all "aaa" to be in color
"bbb" in one color , is it possible?
can anyone help me ?


<method event="onmousetrackover">
setAttribute('bgcolor', 0xFAFAFA);
</method>
<method event="onmousetrackout">
setAttribute('bgcolor', 0xFFFFFF);
</method>

Tanmay
02-02-2009, 10:10 PM
I have worked in such kind of requirement but not exactly on mouse over, kindly specify why you need only three colors..my code was generating different background colors on random basis..check the code below....u may need to change the handlers...

<checkbox id="chk" x="4" text="${parent.text}" width="250">
<handler name="onclick">
<![CDATA[
if (this.value) {
//When a doctor is selected from list
var ii;
var jj = 1;
var rd = Math.round(220 * Math.random());
for (ii = 0; ii < jj; ii++)
{
if (rd < 150)
{
jj = jj + 1;
rd = Math.round(220 * Math.random());
}
else
{
break;
}
}

jj = 1;
ii = 0;
var gr = Math.round(220 * Math.random());
for (ii = 0; ii < jj; ii++)
{
if (gr < 150)
{
jj = jj + 1;
gr = Math.round(220 * Math.random());
}
else
{
break;
}
}

jj = 1;
ii = 0;
var bl = Math.round(230 * Math.random());
for (ii = 0; ii < jj; ii++)
{
if (bl < 150)
{
jj = jj + 1;
bl = Math.round(220 * Math.random());
}
else
{
break;
}
}


var col = "rgb(" + rd + "," + gr + "," + bl + ")";

//Set the random bgcolor for the listitem
this.setAttribute("bgcolor", col);
}
else
{
this.setAttribute("bgcolor", '0xffffff');
}
</handler>

:o:o CHEERS :o:o