js中清除字符串中某个字符串
#create ydds
#date 2009-09-20
//remove src target
function removeStrWithcomma(srcStr, targetStr){
var returnStr = '';
if (srcStr == null || srcStr == '' || srcStr == undefined) {
return returnStr;
}
else
if (srcStr.indexOf(targetStr) == -1) {
return srcStr;
}
else {
var srcStrs = srcStr.split(',');
if (srcStrs.length == 1) {
returnStr = '';
}
else
if (srcStr.match(eval("/^" + targetStr + ".*/")) != null) {
returnStr = srcStr.replace(targetStr + ',', '');
}
else
if (srcStr.match(eval("/.*" + targetStr + "$/")) != null) {
returnStr = srcStr.replace(',' + targetStr, '');
}
else {
returnStr = srcStr.replace(',' + targetStr, '');
}
return returnStr;
}
}
var xmlHttplink;
function createXMLLinkHttpRequest(){
if (window.ActiveXObject) {
xmlHttplink = new ActiveXObject("Microsoft.XMLHTTP");
}
else
if (window.XMLHttpRequest) {
xmlHttplink = new XMLHttpRequest();
}
}
本文出自 “一灯” 博客
相关新闻>>
- 发表评论
-
- 最新评论 更多>>