萬盛學電腦網

 萬盛學電腦網 >> 腳本專題 >> javascript >> Jquery獲取頁面傳值

Jquery獲取頁面傳值

  function request(paras){

  var url = location.href;

  var paraString = url.substring(url.indexOf("?")+1,url.length).split("&");

  var paraObj = {}

  for (i=0; j=paraString[i]; i++){

  paraObj[j.substring(0,j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=")+1,j.length);

  }

  var returnValue = paraObj[paras.toLowerCase()];

  if(typeof(returnValue)=="undefined"){

  return "";

  }else{

  return returnValue;

  }

  }

  //如你給出的地址可以這樣

  var classid = request("classid");

  var id = request("id");

copyright © 萬盛學電腦網 all rights reserved