还有问题,自己修改吧
===========================================================
<style type=text/css>
.select {
BORDER-BOTTOM: buttonface 0px inset; BORDER-LEFT: buttonface 0px inset; BORDER-RIGHT: buttonface 0px inset; BORDER-TOP: buttonface 0px inset; CURSOR: default; FONT: icon; WIDTH: 100px
}
.selected {
BACKGROUND: window; BORDER-BOTTOM: buttonface 0px inset; BORDER-LEFT: buttonface 0px inset; BORDER-RIGHT: buttonface 0px inset; BORDER-TOP: buttonface 0px inset; FONT: icon; PADDING-BOTTOM: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px
}
.selectTable {
BACKGROUND: buttonface; BORDER-BOTTOM: buttonhighlight 2px inset; BORDER-LEFT: buttonhighlight 2px inset; BORDER-RIGHT: buttonhighlight 2px inset; BORDER-TOP: buttonhighlight 2px inset; HEIGHT: 100%; WIDTH: 100%
}
.option {
FONT: icon; PADDING-BOTTOM: 1px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; PADDING-TOP: 1px; WIDTH: 100%
}
.dropDown {
BACKGROUND: window; BORDER-BOTTOM: windowtext 1px solid; BORDER-LEFT: windowtext 1px solid; BORDER-RIGHT: windowtext 1px solid; BORDER-TOP: windowtext 1px solid; PADDING-BOTTOM: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px; POSITION: absolute; VISIBILITY: hidden; WIDTH: 100%
}
.select .button {
BORDER-BOTTOM: buttonhighlight 2px outset; BORDER-LEFT: buttonhighlight 2px outset; BORDER-RIGHT: buttonhighlight 2px outset; BORDER-TOP: buttonhighlight 2px outset; FONT-FAMILY: webdings; FONT-SIZE: 11px; HEIGHT: 5px; PADDING-BOTTOM: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px; WIDTH: 16px
}
</style>
<SCRIPT type=text/javascript>
var overOptionCss = "background: highlight; color: highlighttext";
var sizedBorderCss = "2 inset buttonhighlight";
var globalSelect; //This is used when calling an unnamed selectbox with onclick="this.PROPERTY"
var ie4 = (document.all != null);
var q = 0;
function initSelectBox(el) {
copySelected(el);
var size = el.getAttribute("size");
// These two lines combined with execution in optionClick() allow you to write:
// onchange="alert(this.options[this.selectedIndex].value)"
el.options = el.children[1].children;
el.selectedIndex = findSelected(el); //Set the index now!
// Some methods that are supported on the real SELECT box
el.remove = new Function("i", "int_remove(this,i)");
el.item = new Function("i", "return this.options[i]");
el.add = new Function("e", "i", "int_add(this, e, i)");
// The real select box let you have lot of options with the same NAME. In that case the item
// needs two arguments. When using DIVs you can't have two with the same NAME (or ID) and
// then there is no need for the second argument
el.options[el.selectedIndex].selected = true;
dropdown = el.children[1];
if (size != null) {
if (size > 1) {
el.size = size;
dropdown.style.zIndex = 0;
initSized(el);
}
else {
el.size = 1;
dropdown.style.zIndex = 99;
if (dropdown.offsetHeight > 200) {
dropdown.style.height = "200";
dropdown.style.overflow = "auto";
}
}
}
highlightSelected(el,true);
}
function int_remove(el,i) {
if (el.options[i] != null)
el.options[i].outerHTML = "";
}
function int_add(el, e, i) {
var html = "<div class='option' noWrap";
if (e.value != null)
html += " value='" + e.value + "'";
if (e.style.cssText != null)
html += " style='" + e.style.cssText + "'";
html += ">";
if (e.text != null)
html += e.text;
html += "</div>"
if ((i == null) || (i >= el.options.length))
i = el.options.length-1;
el.options[i].insertAdjacentHTML("AfterEnd", html);
}
function initSized(el) {
//alert("initSized -------->");
var h = 0;
el.children[0].style.display = "none";
dropdown = el.children[1];
dropdown.style.visibility = "visible";
if (dropdown.children.length > el.size) {
dropdown.style.overflow = "auto";
for (var i=0; i<el.size; i++) {
h += dropdown.children[i].offsetHeight;
}
if (dropdown.style.borderWidth != null) {
dropdown.style.pixelHeight = h + 4; //2 * parseInt(dropdown.style.borderWidth);
}
else
dropdown.style.height = h;
}
dropdown.style.border = sizedBorderCss;
el.style.height = dropdown.style.pixelHeight;
}
function copySelected(el) {
var selectedIndex = findSelected(el);
selectedCell = el.children[0].rows[0].cells[0];
selectedDiv = el.children[1].children[selectedIndex];
selectedCell.innerHTML = selectedDiv.outerHTML;
}
// This function returns the first selected option and resets the rest
// in case some idiot has set more than one to selcted :-)
function findSelected(el) {
var selected = null;
ec = el.children[1].children; //the table is the first child
var ecl = ec.length;
for (var i=0; i<ecl; i++) {
if (ec[i].getAttribute("selected") != null) {
if (selected == null) { // Found first selected
selected = i;
}
else
ec[i].removeAttribute("selected"); //Like I said. Only one selected!
}
}
if (selected == null)
selected = 0; //When starting this is the most logic start value if none is present
return selected;
}