Richardetal
asked on
Text color of option element works in Firefox, Chrome, Safari but not IE8
I wanted to change the font color of disabled drop down options for a calendar dated picker. I used the following code:
daysOfMonth.options[28].st yle.color = "red";
which works fine everywhere but in IE8 (not sure about earlier versions of IE).
Any suggestions?
daysOfMonth.options[28].st
which works fine everywhere but in IE8 (not sure about earlier versions of IE).
Any suggestions?
Hi,
where id = 0 to 28
$('DDiv_'+id).className = "translucent";
where DDiv is ur id of ur select option.
$('DDiv_'+id).style.color = "#EE8404";
where id = 0 to 28
$('DDiv_'+id).className = "translucent";
where DDiv is ur id of ur select option.
$('DDiv_'+id).style.color = "#EE8404";
ASKER
These dates are being disabled dynamically so I can't use CSS as you suggest pvlier.
insoftservice: your suggestion appears to be what I have done already. It seems to me that IE doesn't know what to do with the .style.color. I've tried "#FF0000" instead of "red" but that didn't work either.
insoftservice: your suggestion appears to be what I have done already. It seems to me that IE doesn't know what to do with the .style.color. I've tried "#FF0000" instead of "red" but that didn't work either.
ASKER
Here is the weekend function which works in everything but IE.
function remove_weekends(month_id_n ame,year_i d_name) {
for (int_day=1; int_day<=31; int_day++){
var day = document.getElementById(mo nth_id_nam e).value + "/" + int_day + "/" + document.getElementById(ye ar_id_name ).value ;
var d=new Date(day);
var dow=d.getDay(day);
if (dow==0 || dow==6){
daysOfMonth.options[int_da y-1].disab led = true;
daysOfMonth.options[int_da y-1].style .color = "#ff0000";
}
}
}
function remove_weekends(month_id_n
for (int_day=1; int_day<=31; int_day++){
var day = document.getElementById(mo
var d=new Date(day);
var dow=d.getDay(day);
if (dow==0 || dow==6){
daysOfMonth.options[int_da
daysOfMonth.options[int_da
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<head>
<STYLE type="text/css">
OPTION.mar{background-colo
OPTION.white{background-co
</STYLE>
</head>
<body>
<FORM>
<SELECT>
<OPTION>What is your preferred browser?</OPTION>
<OPTION class="mar">Firefox</OPTIO
<OPTION class="white">Internet Explorer</OPTION>
</SELECT>
</FORM>
</body>