2009/10/26

window.location

function onSelectChangeSite(){
   var dropdown = document.getElementById("snssite");
   var index = dropdown.selectedIndex;
   var ddVal = dropdown.options[index].value;

   var current = window.location;
   var re1 = /\?custm/;
   var re2 = /\?/;

   if (re1.test(current))
      window.location = "?custm=" + ddVal;
   else if (re2.test(current))
      window.location = current + "&custm=" + ddVal;
   else
      window.location = "?custm=" + ddVal;

}

No comments:

Post a Comment