var str = "username=xxxx;password=yyy;level=dddd";
function meizz(str, name)
{
var reg = new RegExp("(^|;)"+ name +"=([^;]*)(;|$)");
var r = str.match(reg);
if (r!=null) return r[2]; return null;
}
alert(meizz(str, 'username'));
alert(meizz(str, 'password'));
alert(meizz(str, 'level'));
function meizz(str, name)
{
var reg = new RegExp("(^|;)"+ name +"=([^;]*)(;|$)");
var r = str.match(reg);
if (r!=null) return r[2]; return null;
}
alert(meizz(str, 'username'));
alert(meizz(str, 'password'));
alert(meizz(str, 'level'));
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货