Javascript ~ get GET Variables

function getGetVariable(variableName)
{
 var url=window.location.toString();
 var str="";
 
 if(url.indexOf("?") != -1)
 { 
  var ary = url.split("?")[1].split("&");
  for(var i in ary)
  {
   if(ary[i].split("=")[0] == variableName)
   {
    return ary[i].split("=")[1];
   }
  }
  
 }
 return null;
}

reference
http://bbs.mychat.to/reads.php?tid=545172

沒有留言: