日期:2011-08-17 浏览次数:20890 次
以下是代码: <% response.write getdomain("www.5u.hk") & "<br />" response.write getdomain("blog.5u.hk") & "<br />" response.write getdomain("mscga.blog.5u.hk") & "<br />" function getdomain(byval dom) ’ 返回空则表示域名不复合域名根要求 dim i,ext,exts exts = "com.cn,net.cn,org.cn,hk.cn,com,net,cn,hk" ’ 复根在前,单根在后 ext = split(exts,",") for i = 0 to ubound(ext) if lcase(ext(i)) = right(lcase(dom),len(ext(i))) then dim dom_ext,dom_pre dom_ext = lcase(ext(i)) dom_pre = split(left(dom,len(dom)-len(dom_ext)-1),".") getdomain = dom_pre(ubound(dom_pre)) & "." & dom_ext exit function end if next getdomain = "" end function %> |