<HTML><HEAD><title>漂亮的下拉框</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><SCRIPT>// ViaSelect Environment Constantsvar SS_ENV = new Object();SS_ENV.IE_Version = new Number(((window.navigator.appVersion.split('; ')).split(' ')));SS_ENV.CR = new Object();SS_ENV.CR.ReverseBackground = '#E2519C';SS_ENV.CR.ReverseText = 'white';SS_ENV.CR.Border = '#D55C9A';SS_ENV.CR.BorderActive = '#FF6CB7';SS_ENV.ImgPrefix = 'http://www.viafriend.com/images';SS_ENV.DefaultHeight = 20;SS_ENV.ButtonWidth = 13;SS_ENV.OptionsDivStyle = '' + ' display:none;' + ' z-index:10;' + ' position:absolute;' + ' border:1 solid '+ SS_ENV.CR.Border+';' + ' background-color:white;' + ' scrollbar-face-color:#D4D0C8;' + ' scrollbar-shadow-color:white;' + ' scrollbar-highlight-color:#F6F5F4;' + ' scrollbar-3dlight-color:white' + ' scrollbar-darkshadow-color:#86837E;' + ' scrollbar-track-color:#F6F5F4;' + ' scrollbar-arrow-color:#86837E;';SS_ENV.OptionNobrStyle = '' + ' font-size:12px;' + ' font-family:奔覆;';// SaySelect Variablesvar SS_VAR = new Object();SS_VAR.DivDummy = document.createElement("DIV");SS_VAR.SelectList = new Array();SS_VAR.bEventAttached = false;
var SS_CreatedElements = new Object();
function unloadObjects(){ try { if (SS_VAR && SS_VAR.SelectList) { for (key in SS_VAR.SelectList) {if (SS_VAR.SelectList[key]){ try { SS_VAR.SelectList[key].select.setAttribute('SS', 0); } catch (e) {}; delete SS_VAR.SelectList[key];} } } } catch (e) {};}
attachEvent("onunload", unloadObjects);
function SS_create (srcHTML, ListMax, bAutoDetect){ // property this.ssID = SS_VAR.SelectList.length; this.bOriginalSelect = (bAutoDetect && SS_ENV.IE_Version < 5.5); this.select = SS_createElement(srcHTML); this.selectedIndex = this.select.selectedIndex; this.options = this.select.options; this.width = parseInt(this.select.style.width); this.height = (this.select.style.height) ? parseInt(this.select.style.height) : SS_ENV.DefaultHeight; this.OptionHeight = this.height - 4; this.bListDown = (ListMax && '-'==ListMax.toString().substr(0, 1)) ? false : true; this.ListMax = (!isNaN(parseInt(ListMax))) ? Math.abs(ListMax) : 100;
this.Table; this.TitleDiv; this.TitleTable; this.TitleWrapper; this.OptionsDiv; this.OptionsWrapper; this.OptionsTable; this.bFocused = false; this.bExpanded = false; this.bReverse = false;
// private method this.isThisEventToBeCanceled = SS_isThisEventToBeCanceled; this.toggleTitle = SS_toggleTitle; this.syncSelectedIndex = SS_syncSelectedIndex; this.toggleOptions = SS_toggleOptions; this.turnOnOption = SS_turnOnOption; this.turnOffOption = SS_turnOffOption; this.handleMousewheel = SS_handleMousewheel; this.handleOverTitle = SS_handleOverTitle; this.handleOutTitle = SS_handleOutTitle; this.handleOverOption = SS_handleOverOption; this.createTable = SS_createTable; this.createTitleDiv = SS_createTitleDiv; this.createOptionsDiv = SS_createOptionsDiv; this.createOptionTr = SS_createOptionTr; this.adjustOptionsDiv = SS_adjustOptionsDiv; this.syncOptions = SS_syncOptions; this.pressOption = SS_pressOption; this.moveOption = SS_moveOption; this.releaseOption = SS_releaseOption; this.pressTitle = SS_pressTitle; this.releaseTitle = SS_releaseTitle;
// public method this.display = SS_display; this.insertOption = SS_insertOption; this.deleteOption = SS_deleteOption; this.changeOption = SS_changeOption;
// initiate this.createTable(); this.select.setAttribute('SS', this); if (!this.bOriginalSelect) this.select.onpropertychange = SS_handlePropertychange; SS_VAR.SelectList[this.ssID] = this;}function SS_display (){ document.write("<div id=SS_TempDiv></div>\n"); document.all.SS_TempDiv.appendChild(this.Table); document.all.SS_TempDiv.removeNode();}function SS_write (srcHTML, ListMax, bAutoDetect){ var oSS = new SS_create(srcHTML, ListMax, bAutoDetect); oSS.display(); return oSS;}function SS_insertOption (value, innerText, idx){ var NewOption = document.createElement("OPTION"); SS_CreatedElements[SS_CreatedElements.length] = NewOption; this.options.add(NewOption, idx); NewOption.innerText = innerText; NewOption.value = value;
if (!this.bOriginalSelect) this.createOptionTr(idx); this.syncOptions(); this.adjustOptionsDiv(); this.syncSelectedIndex();}function SS_deleteOption (idx){ this.options.remove(idx); if (!this.bOriginalSelect) this.OptionsTable.deleteRow(idx); this.syncOptions(); this.adjustOptionsDiv(); this.syncSelectedIndex();}function SS_changeOption (idx, value, innerText){ this.options[idx].value = value; this.options[idx].innerText = innerText; this.syncOptions(); this.syncSelectedIndex();}
function SS_cancelEvent (event){ event.cancelBubble = true; event.returnValue = false;}function SS_isThisEventToBeCanceled (event){ if ('object' == typeof(event)) { switch (event.type) { case 'mousedown': if (!(event.button & 1)) return true; break; case 'mouseup': if (!(event.button & 1)) return true; if (SS_ENV.IE_Version >= 5.5 && event.srcElement != this.srcElementOfLastMousedown && this.srcElementOfLastMousedown != null) { this.srcElementOfLastMousedown = null; return true; } break; case 'mouseout': if (!(SS_ENV.IE_Version < 5.5 && event.srcElement == this.srcElementOfLastMousedown)) return true; break; case 'mousemove': if (SS_ENV.IE_Version >= 5.5 && event.srcElement != this.srcElementOfLastMousedown && this.srcElementOfLastMousedown != null) return true; break; } } return false;}function SS_createElement (html){ SS_VAR.DivDummy.insertAdjacentHTML('afterBegin', html); var oEl = SS_VAR.DivDummy.children(0); while (SS_VAR.DivDummy.children.length > 0) { SS_VAR.DivDummy.removeChild(SS_VAR.DivDummy.children(0)); } return oEl;}function SS_blurExcept (except){ SS_cancelEvent(window.event);
except = ('number'==typeof(except)) ? except : -1;
var bHasToDetachEvent = true; for (var i=0; i < SS_VAR.SelectList.length; i++) { if (-1==except && SS_VAR.SelectList[i].bFocused && SS_VAR.SelectList[i].bExpanded) { SS_VAR.SelectList[i].toggleOptions(false,
评论: ! 查看更多评论
内容: !
验证码: (注“!”为必填内容。)