I am trying to change text color or background color for different options using javascript, please look at code above.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.
TheGraphicsExpe... posted this at 19:28 — 17th July 2000.
They have: 184 posts
Joined: Jun 2000
I'm not quite sure what you're asking--care to elaborate?
dhaliwam posted this at 19:52 — 17th July 2000.
They have: 39 posts
Joined: Jun 2000
I guess select box is a better example, is it possible to use different colors for different options dynamically
EmpID.options.length = 0;
for (var i = 0; i < Emp.getRowCount(); i++) {
NewOpt = new Option;
NewOpt.value = Emp.id[i];
NewOpt.text = Emp.employee_name[i];
if( Emp.id[i] == objects_array[r].object_id)
NewOpt.text.style="color:red;"
else
NewOpt.text.style="color:blue;"
EmpID.options[EmpID.options.length] =NewOpt;
}
TheGraphicsExpe... posted this at 20:03 — 17th July 2000.
They have: 184 posts
Joined: Jun 2000
Hmm.. You -could- try to specify different style attributes to each one.
Like..
dhaliwam posted this at 20:07 — 17th July 2000.
They have: 39 posts
Joined: Jun 2000
Actually thats not possible because I am populating that list dynamically
Lloyd Hassell posted this at 04:54 — 18th July 2000.
They have: 231 posts
Joined: Feb 2000
Only in IE4+
document.body.style.backgroundColor = COLOR;
dhaliwam posted this at 12:54 — 18th July 2000.
They have: 39 posts
Joined: Jun 2000
Thanks but I am not sure if its going to work for a select box
dhaliwam posted this at 13:07 — 18th July 2000.
They have: 39 posts
Joined: Jun 2000
I am trying to change text color or background color for different options using javascript, please look at code above.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.