//获取当前网页文档路径
var curPath=windows.document.location.href;
//一般是排除服务器之后的路径
var pathName=windows.document.location.pathname;
//获得服务路径的结束点
var pos =curPath.indexOf(pathName);
//获得服务路径
var localhostPath=curPath.substring(0,pos);
//一般是服务器后面紧跟着的第一个项目的名称
var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);
//IIS发布后的路径地址
var SiteURL=localhostPath+projectName;