帮忙吧下面的asp转为js,谢谢!
<% function chX(str) dim i,a,b a = split(str,"-") for i = 0 to ubound(a) b = a(i) if len(b) = 1 then b = "0" & b chX = chX & b & "-" next if chX <> "" then chX = left(chX,len(chX)-1) end function %>
<% function chX(str) dim i,a,b a = split(str,"-") for i = 0 to ubound(a) b = a(i) if len(b) = 1 then b = "0" & b chX = chX & b & "-" next if chX <> "" then chX = left(chX,len(chX)-1) end function %>
答案:function chX(str){
var ret="";
var a = str.split("-");
for(var i=0;i<a.length;i++){
var b = a[i];
if(b.length == 1)
b="0" + b;
ret += b + "-";
}
if(ret != "")ret = ret.substring(ret.length - 1);
return ret;
}
上一个:asp代码是什么意思
下一个:asp.net站点地图,这个代码有问题么?为什么我用Menu连接,显示不了子菜单?!!!