Use pictures to make SELECT (Opiton) background

xiaoxiao2021-03-06  50

Like the scroll bar, background, the pictures are btn_down.gif, btn_down_s.gif and IMG_BLANK.GIF. Sayselect.js: ------------------------------------------------ -------------------- // Sayselect Environment constantsvar ss_env = new object (); ss_env.ie_version = new number ((("Window.navigator.AppVersion.split (' ; ')) [1] .split (' ')) [1]); ss_env.cr = new object (); // Mouse pointing to the background color SS_ENV.Cr.ReverseBackground =' # 225588 '; // mouse Point to the font color ss_env.cr.reversetext = '#ffffff'; // SELECT edge frame color SS_ENV.CR.BORDER = '# 808080'; // Mouse Slow SS_ENV.CR.BORDERACTIVE = ' # 225588 '; // Specify picture directory SS_ENV.IMGPREFIX =' images'; // Set the H, w value ss_env.defaultHeight = 20; ss_env.bottonwidth = 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: 9pt;' 'font-family: arian; // 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.SelectedIndIndex; 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; THISTMAX = (! isnan (parseint (listmax)))? Math.abs (Listmax): 100;

THIS.TITLED; this.Titletable; this.titlewrapper; this.optionsdiv; this.optionswrapper; this.boptionStable; this.bfocused = false; this.bfocused = 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_DELETE Option; 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 ("

/ 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 (ID) x); this.SyncOptions (); this.adjustOptionsdiv (); this.syncselectedIndIndex ();} 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.insertadjacnt HTML ('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

IF (this.boriginalselect) return;

IF (this.titletable.cells (0) .childNodes (0) .innerText! = this.Options [this.selected ".innertext) this.titletable.cells (0) .childnodes (0) .innertext = this.Options [ this.selectedIndex] .innerText; if (this.bExpanded) this.toggleOptions (false);} function SS_toggleTitle (bReverse) {this.bReverse = ( 'undefined' = typeof (bReverse)!) bReverse:?! (this.bReverse ); This.titletable.cells (0) .style.backgroundColor = this.breverse? S_env.creversebackground: '; this.titletable.cells (0) .Style.color = this.breverse? Ss_env.cr.reverseTextext :? '';} function SS_toggleOptions (bExpanded, bStrict) {(!! bStrict && this.bFocused) if {SS_blurExcept (this.ssID);} this.bExpanded = ( '! undefined' = typeof (bExpanded)) bExpanded: (! this.bexpanded); if (this.bexpanded) {this.adjustOptionsdiv (); this.optionsdiv.style.display = 'block'; if (! bstrict) {this.ToggletEtitle (FALSE); this.handleOverOption (this. .selectedindex;} this.handleoutTitle ();} else {this.Optionsdiv.s Tyle.display = 'None'; if (! bstrict) {this.ToggletE (TRUE);}}}}}} (! bstrict) {this.bfocused = true; if (! ss_var.beventattached) {document.attachevent ('onmousedown " , SS_blurExcept); document.attachEvent ( 'ondblclick', SS_blurExcept); SS_VAR.bEventAttached = true;}}} function SS_handlePropertychange () {if ( 'propertychange' == window.event.type && 'selectedIndex' == window.event .propertyname) {var od = window.event.srcelement.ss; oss.syncselectedIndex ();

if (null = oSS.select.onchange!) oSS.select.onchange ();}} function SS_handleMousewheel (event) {var idx = this.selectedIndex; if ( 'mousewheel' == event.type && this.bFocused && this .Breverse) {for (var i = 0; i Event.wheeldelta; i - = 120) IDX ;} IDX = Math .max (idx, 0); idx = math.min (IDX, this.Options.Length - 1); this.select.selectedIndex = idx;} function ss_handleOvertitle () {if (this.bexpanded) return; this.titletable .style.bordercolor = ss_env.cr.BorderActive; this.titletable.cells (1) .stile.display = 'none'; this.titletable.cells (2) .style.display = 'block';} function ss_handleoutTitle () {This.titletable.Style.BorderColor = SS_ENV.CR.BORDER; this.titletable.cells (2) .style.display = 'none'; this.titletable.cells (1) .style.display = 'block';} Function SS_HANDLEOVEROPTION (IDX) {for (VAR i = 0; I <.Options.length; i ) {if (i == idx) this.turnonOption (i); else this.turnoffoption (i );}} Function SS_turnOnOption (idx) {this.OptionsTable.cells (idx) .style.color = SS_ENV.CR.ReverseText; this.OptionsTable.cells (idx) .style.backgroundColor = SS_ENV.CR.ReverseBackground;} function SS_turnOffOption (idx) {this.OptionsTable.cells (idx) .style.color = ''; this.OptionsTable.cells (idx) .style.backgroundColor = '';} function SS_adjustOptionsDiv () {if (this.bOriginalSelect) return ;

This.Optionsdiv.style.Width = this.width; this.Optionsdiv.style.Height = math.min (this.Options.Length, this.listmax) * this.OptionHeight 2; this.OptionSwrapper.Style.Height = THIS .Options.Length * this.OptionHeight; this.Optionsdiv.style.Overflowy = (this.Options.Length> this.listmax)? 'scroll': ''; var top = this.oft.offSettop; var left = this. Table.offsetleft; for (var el = this.table.offsetparent; 'body'! = El.tagname && 'absolute'! = El.style.position && 'relative'! = El.style.position; el = EL. OffsetParent) {if ('Table'! = EL.TAGNAME) {TOP = El.clienttop; Left = El.ClientLeft;} TOP = El.offSettop; Left = El.offsetleft;} this.Optionsdiv.Style .top = (THIS.BLISTDOWN): (Top - Parseint (this.Optionsdiv.style.Height); this.Optionsdiv.style.left = left;

This.titleWrapper.Style.top = 0; this.titleWrapper.Style.Left = 0;} function ss_syncOptions () {if (this.boriginalselect) return;

For (var i = 0; i

This.SrcelementOflastMousedown = Event.srcelement;

THIS.TOGGLEOPTIONS ();} function ss_releasetitle (event) {ss_cancelevent (event);

IF (this.isthisEventtobecanceled (Event)) Return;

this.srcElementOfLastMousedown = null;} function SS_pressOption (event) {SS_cancelEvent (event); this.srcElementOfLastMousedown = event.srcElement;} function SS_moveOption (event) {SS_cancelEvent (event);

IF (this.isthiseventtobecanceled (Event)) Return; if (! (! (! (! (! (! (! (!) Return (!) Return;

THIS.HANDLEOVEROPTION (Math.FfSety / this.OptionHeight);} Function SS_RELEASEOPTION (Event) {ss_cancelevent (event);

IF (this.isthisEventtobecanceled (Event)) Return;

THIS.SRCELEMENTOFLASTMOUSEDOWN = NULL;

if (event.offsetX> = 0 && event.offsetX <= this.OptionsTable.offsetWidth) {this.toggleOptions (false); this.select.selectedIndex = Math.floor (event.offsetY / this.OptionHeight);}} function SS_CREATETABLE () {this.table = ss_createElement (" "

" "
" " "); if (! isnan (this.width) this.table.style.width = this.width; this.table.style.height = this.Height;

IF (! this.boriginalselect) {this.createTitlediv (); this.createOptionsdiv (); this.table.cells (0) .appendchild (this.titlediv); this.table.cells (0) .appendchild (this.Optionsdiv } Else {this.table.cells (0) .appendchild (this.select);}} function ss_createTitlediv () {this.titlediv = ss_createElement (" "

" " " " "
" " " " " " " " " "); this.titletable = this.titlediv.childNodes (0); this.titletable.cells (0) .childNodes (0) .innertext = this.Options [this.selected ".innertext; this.titletable.cells (1) .innerhtml =" <

IMG SRC = '" SS_ENV.IMGPREFIX " / btn_down.gif' Border = 0 align = Absmiddle> "; this.titletable.cells (2) .innerhtml =" "; this.titletable.cells (3) .appendchild (this.select); this.titlewrapper = document.createElement (" ""); SS_CreatedElements [SS_CreatedElements.length] = this.TitleWrapper; this.TitleDiv.appendChild (this.TitleWrapper );

} Function SS_createOptionsDiv () {this.OptionsDiv = SS_createElement ( "" "

" " "" ""); this.OptionStable = this.Optionsdiv.childNodes (0); for (var i = 0; i "); SS_CreatedElements [SS_CreatedElements.length] = this.OptionsWrapper; this.OptionsDiv.appendChild (this.OptionsWrapper);

转载请注明原文地址:https://www.9cbs.com/read-61013.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.046, SQL: 9