Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function load{
- var shippingLocation = document.getElementById("location");
- var swap = null;
- var initiallyFirstItem = shippingLocation.options[0].cloneNode(true);
- var lastPos = null;
- for(var i = 0; i < shippingLocation.length; i++)
- {
- if(shippingLocation.options[i].value == "XETEX")
- {
- swap = shippingLocation.options[i];
- lastPos = i;
- break;
- }
- }
- console.debug("sl: " + shippingLocation.options[0]);
- console.debug("s: " + swap);
- shippingLocation.options[0] = swap;
- shippingLocation.options[lastPos] = initiallyFirstItem;
- shippingLocation.selectedIndex = 0;
- }
- shippingLocation.options[0] = swap;
- shippingLocation.options[0] = swap;
- > Removed due to excessive stupidity on
- > my part. :P
- <script type="text/javascript">
- function swap(obj,i,j) {
- sib=obj.options[i].nextSibling;
- obj.insertBefore(obj.options[i],obj.options[j]);
- obj.insertBefore(obj.options[j],sib);
- }
- </script>
- function swapOptions(obj,i,j){
- var o = obj.options;
- var i_selected = o[i].selected;
- var j_selected = o[j].selected;
- var temp = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
- var temp2= new Option(o[j].text, o[j].value, o[j].defaultSelected, o[j].selected);
- o[i] = temp2;o[j] = temp;o[i].selected = j_selected;o[j].selected = i_selected;
- }
Add Comment
Please, Sign In to add comment