|
Post by segadragon on Apr 24, 2006 0:41:05 GMT
Creator: GAMEchief, a.k.a. SegaDragon Description: The skin list in your profile is arranged by date added. This script will alphabetize the skin list. Placement: Main Footer Version: 1.2 <script type="text/javascript"> <!--
/* Skin List Alphabetizer by GAMEchief, a.k.a. SegaDragon Do not remove this notice for any reason. http://oblivionrealm.proboards31.com/ */
selec = document.getElementsByTagName("select"); for (t=0; t<selec.length; t++) { if (selec[t].name == "skin") { z = selec[t].options[selec[t].selectedIndex].value; opt = selec[t].options; arr = new Array(); val = new Array(); for (x=0; x<opt.length; x++) { arr[x] = opt[x].innerHTML; val[arr[x]] = opt[x].value; } function alphabetize(a, b) { var A = a.toLowerCase(); var B = b.toLowerCase(); if (A < B) return -1; if (B < A) return 1; return 0; } arr.sort(alphabetize); for (x=0; x<arr.length; x++) { selec[t].options[x].innerHTML = arr[x]; selec[t].options[x].value = val[arr[x]]; if (val[arr[x]] == z) selec[t].selectedIndex = x; } } }
//--> </script> This is my first attempt to ever alphabetize with JavaScript. Please leave comments in this topic.
|
|