//get base URL
var _urlstr = window.location.href;
if (_urlstr.indexOf("?") > -1) {
_urlstr = _urlstr.substring(0, _urlstr.lastIndexOf("?"));
}
_urlstr = _urlstr.substring(0, _urlstr.lastIndexOf("/"));
_urlstr = _urlstr.substring(0, _urlstr.lastIndexOf("/"));
例如:http://localhost:1781/tool/yakujihou.aspx
_urlstr为:http://localhost:1781