Homemade beautiful SELECT

zhaozj2021-02-16  41

The effect is as shown:

code show as below:

Beautiful drop-down box </ title> <meta http-equiv = "content-type" content = "text / html; charSet = GB2312> <script> // viaslect environment constantsvar ss_env = New object (); ss_env.ie_version = new number ((WINDOW.NAVIGATOR.AppVersion.split (';')) [1] .split ('')) [1]); ss_env.cr = new Object () Ss_env.cr.reversebackground = '# e2519c'; ss_env.cr.revetetext = 'White'; ss_env.cr.Border = '# d55c9a'; ss_env.cr.BordERACTIVE = '# ff6cb7'; 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: rings; '; // sayselect variablesvar ss_var = new Object (); ss_var.divdummy = document.createElement ("div"); ss_var.selectlist = new array (); ss_var.beventtached = false;</p> <p>Var ss_createdeelements = new object (); IMG_S_SRC = "btn_down_s.gif"; IMG_SRC = "btn_down.gif"; IMG_BLANK_SRC = "IMG_BLANK.GIF";</p> <p>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;</p> <p>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;</p> <p>THIS.TITLED; this.Titletable; this.titlewrapper; this.optionsdiv; this.optionswrapper; this.boptionStable; this.bfocused = false; this.bfocused = false; this.breverse = false;</p> <p>// 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.changeOptio N = ss_changeoption;</p> <p>// 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> / 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.OptionsTable.deleteRow (idx) (this.bOriginalSelect!); this . SyncOptions (); th is.adjustOptionsDiv (); this.syncSelectedIndex ();} function SS_changeOption (idx, value, innerText) {this.options [idx] .value = value; this.options [idx] .innerText = innerText; this.syncOptions () Im.syncselectedindex ();</p> <p>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! =</p> <p>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);</p> <p>Except = ('Number' == TypeOf (Except))? EXCEPT: -1;</p> <p>Var bhastodetachevent = true; for (var i = 0; i <ss_var.selectlist.length; i ) {if (-1 == Except && ss_var.selectlist [i] .bfocused && ss_var.selectlistList [i] .bexpanded) { SS_VAR.SelectList [i] .ToggleOptions (false, true); ss_var.selectlist [i] .togglet = false;} else if (i! = Except) {if (ss_var.selectList [i] .bexpanded ) SS_VAR.SelectList [i] .ToggleOptions (false, true); if (ss_var.selectlist [i] .breverse) ss_var.selectList [i] .TogGletitle (false); ss_var.selectList [i] .bfocused = false;} } if (SS_VAR.bEventAttached && bHasToDetachEvent) {document.detachEvent ( 'onmousedown', SS_blurExcept); document.detachEvent ( 'ondblclick', SS_blurExcept); SS_VAR.bEventAttached = false;}} function SS_syncSelectedIndex () {this.selectedIndex = this .select.selectedindex;</p> <p>IF (this.boriginalselect) return;</p> <p>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.handleutTitle ();} else {this.Optionsdiv.style.display = 'none'; if (! BSTRI) ct) {this.toggleTitle (true);}!} if (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 oSS = window.event. Srcelement.ss; oss.syncselectedIndex ();</p> <p>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 -; 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) {th is.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 () {i (this.boriginalselect) Return;</p> <p>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 = this.table.offSetParent; 'body'! = El.tagname && 'absolute'! = El.style.position && 'relative'! = El.style.position;</p> <p>EL = El.offSetParent) {if ('Table'! = EL.TAGNAME) {TOP = El.clienttop; Left = El.ClientLeft;} TOP = El.offSettop; Left = el.offsetleft;} this .Optionsdiv.style.top = (TOP THISTDOWN): (Top - Parseint (this.Optionsdiv.style.Height); this.Optionsdiv.style.Left = left;</p> <p>This.titleWrapper.Style.top = 0; this.titleWrapper.Style.Left = 0;} function ss_syncOptions () {if (this.boriginalselect) return;</p> <p>For (var i = 0; i <this.Options.Length; i ) {this.OptionStable.cells (i) .SetaTRibute ('INDEX', I); if (this.OptionStable.cells (i) .childnodes (0 ) .innertext! = this.Options [i] .innertext) this.OptionStable.cells (i) .ChildNodes (0) .innertext = this.Options [i] .innertext;}} function ss_presstitle (event) {ss_cancelevent (Event) );</p> <p>This.SrcelementOflastMousedown = Event.srcelement;</p> <p>THIS.TOGGLEOPTIONS ();} function ss_releasetitle (event) {ss_cancelevent (event);</p> <p>IF (this.isthisEventtobecanceled (Event)) Return;</p> <p>THIS.SRCELEMENTOFLASTMOUSEDOWN = NULL;} Function SS_PRESSOPTION (Event) {ss_cancelevent (event);</p> <p>this.srcElementOfLastMousedown = event.srcElement;} function SS_moveOption (event) {SS_cancelEvent (event); if (this.isThisEventToBeCanceled (event)) return;! if ((event.offsetX> = 0 && event.offsetX <= this.OptionsTable .offsetwidth)))).</p> <p>THIS.HANDLEOVEROPTION (Math.FfSety / this.OptionHeight);} Function SS_RELEASEOPTION (Event) {ss_cancelevent (event);</p> <p>IF (this.isthisEventtobecanceled (Event)) Return;</p> <p>THIS.SRCELEMENTOFLASTMOUSEDOWN = NULL;</p> <p>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 (" " <table border = 0 cellpadding = 0 cellspacing = 0 style = 'table-layout: fixed; cursor: default'> " " <tr> <td> </ TD> </ tr> " " </ table> "); if (! isnan (this.width) this.table.style.width = this.width; this.table.style.height = this.Height;</p> <p>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 (" " <div sty = 'position: relative; top: 0 Left: 0; '> " " <Table Border = 0 cellpadding = 0 cellspacing = 1 " " Height = " this.Height " BGColor = White " " style =' table-layout: fixed; border: 1 Solid " SS_ENV.CR.BORDER "; '" " οnmοuseοver =' ss_var.selectlist [" " ssid "]. AdjustOptionsdiv () '" "> " <tr> " " <td> <nobr style = 'text-Oveflow: hidden; " ss_env.optionnobrstyle "> </ nobr> </ td> " " <td width = " SS_ENV.BUTTONWIDTH " Align = Center Style =' Word-Wrap: Normal '> </ td> "<td style =' display: none 'width =" SS_ENV.BUTTONWIDTH "Align = Center Style =' Word-Wrap: Normal '> </ td>" "<TD Style = 'Display: None'> </ td> " " </ Tr> " " </ table> " " </ div> "); this.titletable = this.titl Ediv.childNodes (0); this.titletable.cells (0) .childNodes (0) .innerText = this.Options [this.selected ".innerText; this.titletable.cells (1) .innerhtml =" <img src = '" IMG_SRC "' Border = 0 align =</p> <p>Absmiddle> "; this.titletable.cells (2) .innerhtml =" <img src = '" IMG_S_SRC "' border = 0 align = absmiddle> "; this.titletable.cells (3) .appendchild (this.select) This.titleWrapper = Document.createElement (" " <IMG SRC = '" IMG_BLANK_SRC "' " " style = 'POSITION: Absolute; Top: 0; Left: 0; Z-Index: 2; Width: 100 %; Height: " this.height "; '" " οnmοuseοver =' s_var.selectlist [" this.ssid "]. HandleOvertitle () '" " οnmοuseοut =' ss_var.selectriTlist [" this.ssid " ] .HandleOuttitle (); ss_var.selectlist [" this.ssid "]. ReleaseTitle (Window.Event); '" " οnmοusedοwn =' ss_var.selectlist [" this.ssid "]. Presstitle (Window.Event) '" " ΟNDBLCLICK =' ss_var.selectlist [" this.ssid "]. PressTitle (window.event); ss_var.selectlist [" this.ssid "]. ReleaseTitle (</p> <p>Window.event); '" " οnmοuseup =' ss_var.selectlist [" this.ssid "]. ReleaseTitle (Window.Event) '" " onMousewheel =' ss_var.selectlist [" this.ssid "]. HandleMousewheel (window.event) ' " " οndragstart =' SS_cancelEvent (window.event) ' " "> "); SS_CreatedElements [SS_CreatedElements.length] = this.TitleWrapper; this.TitleDiv.appendChild (this.TitleWrapper);} function SS_createOptionsDiv () {this.OptionsDiv = SS_createElement ( "" "<div style = '" SS_ENV.OptionsDivStyle "'" "οnscrοll = 'SS_VAR.SelectList [" this.ssID "]. moveOption (window.event) '" " Οnmοusedοwn =' s_cancelevent (window.event) '" "> " " <table border = 0 cellpadding = 0 cellspacing = 0 width = 100% style =' table-layout: fixed '> " " < / Table> " " </ div> "); this.OptionStable = this.Optionsdiv.childNodes (0); for (var i = 0; i <this.Options.length; i ) {this.createOptiontr (i) This.SyncOptions (); this.Optionswrapper = document.createElement (" " <img src = '" IMG_BLANK_SRC "' " " style = 'position: absolute; Top: 0; Left: 0; width: 100% ; '" " Οnmοusedοwn =' ss_var.selectList [" this.ssid "]. Pressoption (window.event) '" " οnmοusemοve =' ss_var.SSELECTLIST [" this.ssid "]. MoveOption (window.event ) '" " Οnmοuseup =' ss_var.selectlist [" </p> <p>this.ssID "]. releaseOption (window.event) '" "οnmοuseοut =' SS_VAR.SelectList [" this.ssID "]. releaseOption (window.event) '" "οndragstart =' SS_cancelEvent (window.event) ' " "> "); SS_CreatedElements [SS_CreatedElements.length] = this.OptionsWrapper; this.OptionsDiv.appendChild (this.OptionsWrapper);} function SS_createOptionTr (idx) {idx = ('! undefined '= typeof (idx)) ? idx: this.Options.Length - 1; var optiontr = this.OptionStable.inSertrow (-1); var optiontd = document.createElement ("<td height =" this.OptionHeight > </ td> "); SS_CreatedElements [SS_CreatedElements.length] = this.OptionsTd; OptionTd.appendChild (document.createElement ( "<nobr style = '" SS_ENV.OptionNobrStyle "'> </ nobr>")); OptionTr.appendChild (OptionTd);} < / Script> </ head> <body> <script> ss_write ("<select style = 'width: 60; Height: 18px; font-size: 12px' name = star> / n" "<option value = /" / "SELECTED> Unlimited </ option> / n" <option value = / "Aquarius /"> Aquarius </ option> "<option value = /" Pisces / "> Pisces </ option> " " <option value = / "Aries /"> Aries </ option> "<option VA Lue = / "Taurus /"> Taurus </ option> "<option value = /" Double Subtock / "> Double Subtot </ Option> " <option value = / "Cancer /" Cancer </ Option> " "<option value = /" Leo / "> Leo </ option> " <option value = / "Virgo /"> Virgo <</p> <p>/ option> " " <option value = / "Libra /"> Libra </ option> "<option value = /" Scorpio / "> Scorpio </ option> " <option value = / "shooter seat / ">> Sagittarius </ option> <option value = /" Capricorn / "> Capricorn </ option>" "</ SELECT> / N"); </ script> <br> <script> ss_write ("<select name = 'province' style = 'width: 60; Height: 18px; font-size: 12px'> / n" "<option value = /" / "selected> DUBS </ option> / n " " <option value = / "Beijing /"> Beijing </ option> "<option value = /" Shanghai / "> Shanghai </ option>" "<option value = /" Tianjin / " </ option> "<option value = /" Chongqing / "> Chongqing </ option> " <option value = / "Anhui /"> Anhui </ option> "<option value = /" Fujian / "> 福建 </ option> <option value = /" Gansu / "> Gansu </ option>" "<option value = /" Guangdong / "> Guangdong </ option> " <option value = / "Guangxi /"> Guangxi </ option> "<option value = /" Guizhou / "> Guizhou </ option>" "<option value = /" Hainan / "> Hainan </ option>" <option value = / "Hebei /"> Hebei </ option> "<option value = /" Heilongjiang / "> Heilongjiang </ option> " <option value = / "Henan /"> Henan </ Option> " " <option value = / "Hubei /"> Hubei </ option> " " <option value = / "Hunan /"> Hunan </ option> " " <</p> <p>Option value = / "Inner Mongolia /"> Inner Mongolia </ option> "<option value = /" Jiangsu / "> Jiangsu </ option>" "<option value = /" Jiangxi / "> Jiangxi </ Option> " " <option value = / "Jilin /"> Jilin </ option> <option value = / "Liaoning /"> Liaoning </ option> "<option value = /" Ningxia / "> Ningxia </ option> "<option value = /" Qinghai / "> Qinghai </ option> " <option value = / "Shanxi /"> Shanxi </ option> "<option value = /" Shaanxi / "> Shaanxi </ option> " <option value = / "Shandong /"> Shandong </ option> "<option value = /" Sichuan / "> Sichuan </ option> " <option value = / "Jiangxi /"> Jiangxi </ option> "<option value = /" Tibet / "> Tibet </ option> " <option value = / "Xinjiang /"> Xinjiang </ option> " <option value = / "Yunnan /"> Yunnan </ option> "<option value = /" Zhejiang / "> Zhejiang </ option>" "<option value = /" other / "> Other </ Option> " " </ SELECT> / N ", 8); </ script> </ body> </ html> where IMG_S_SRC =" btn_down_s.gif "; // pull-down box drop button picture IMG_SRC =" btn_down. GIF "; // The image moved on the drop button on the drop button IMG_BLANK_SRC =" img_blank.gif "; // Blank picture</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-26276.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="26276" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.037</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'lGYizl5U0QB_2F6MNxO2Wk8_2BFdp6NT_2FsFNI85c_2FUOq2lnWjfnYNympXU794z67SVCsdbjTYwXlItU5ThQPootEZQ_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>