Heres a copy of the script:
function renderSelectOptions() {
var containerStyle = 'border:1px solid black;width:200px;margin-bottom:5px;font-family:Calibri;';
var headingStyle = 'margin:0px;padding:3px; text-align:center;background-color:SteelBlue;color:white;';
var oddDetailStyle = 'display:block;border-top:1px solid black;background-color:#e9e9e9;padding-left:3px;';
var evenDetailStyle = 'display:block;border-top:1px solid black;background-color:LightSteelBlue;padding-left:3px;';
var selectArray = document.getElementsByTagName('select');
var theHtml = '';
var currentStyle = 'evenDetailStyle';
for(i=0;i<selectArray.length;i++) {
theHtml += '<div id="div_' + selectArray[i].name + '" style="' + containerStyle + '"><h4 style="' + headingStyle + '">' +
selectArray[i].name + '</h4>';
var optionArray = selectArray[i].getElementsByTagName('option');
for(n=0;n<optionArray.length;n++) {
if(currentStyle == 'evenDetailStyle')
currentStyle = 'oddDetailStyle';
else
currentStyle = 'evenDetailStyle';
theHtml += '<span style="' + eval(currentStyle) + '">' + optionArray[n].innerHTML + '</span>';
}
theHtml += '</div>';
}
document.write(theHtml);
}
0 comments:
Post a Comment