View Code
function GetValueByKey(strs, key, sp)
{
key
= key.toLowerCase();
strs
= strs.toLowerCase();
if (strs.indexOf(key + "=") > -1)
{
var result;
var s = strs.substring(strs.indexOf(key + "="));
if (s.indexOf(sp) != -1)
{
result
= s.substring(s.indexOf(key + "=") + key.length + 1, s.indexOf(sp));
}
else
{
if (s.indexOf(key + "=") != -1)
{
result
= s.substring(s.indexOf(key + "=") + key.length + 1);
}
}
}
return result;
}
// var strs = "A=1,B=2,c=3,d=4,ee=";
// document.write( GetValueByKey(strs, "B", ","));
--value 2
新手 好像代码布局有点乱 没有调好
 posted on 2011-02-18 14:42  纳兰_容若  阅读(784)  评论(0编辑  收藏  举报