遇到数据库字符串只有空格的关键字;
用以下JS函数来处理;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> split 字符分割 JS 函数</title>
<SCRIPT LANGUAGE="JavaScript">
function sk_split(keywords){
str=keywords;
var strs= new Array(); //定义一数组
strs=str.split(" "); //字符分割
for (i=0;i<strs.length ;i++ )
{
document.write("<a class=skbq target=_blank href=/?kw="+strs[i]+">"+strs[i]+"</a> "); //分割后的字符输出
}
}
</SCRIPT>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">sk_split("酷 微 薄");</SCRIPT>
</body>
</html>