js获取指定字符前/后的字符串



 


var st = "javascript:zhifu('index.php?s=/addon/xxxx/Alipay/index/cartid/1964/addid/162/invid/648/couponsid/11/paytype/2/type/3/fu/38.8/giveid/70,/givenum/1,/voucher//default',162)";


var before_str = getStr(st,"giveid");
alert(before_str);

结果:

javascript:zhifu('index.php?s=/addon/xxxx/Alipay/index/cartid/1964/addid/162/invid/648/couponsid/11/paytype/2/type/3/fu/38.8/

你可能感兴趣的:(js)