首页 > Web开发 > 详细

js中判断空及获取当前服务的根路径

时间:2016-06-27 12:12:54      阅读:175      评论:0      收藏:0      [点我收藏+]

function isValue(o) {
return (this.isObject(o) || this.isString(o) || this.isNumber(o) || this.isBoolean(o));
}
function isString(o) {
return typeof o === ‘string‘;
}
function isObject(o){
return (o && (typeof o === ‘object‘ || $.isFunction(o))) || false;
}
function isNumber(o) {
return typeof o === ‘number‘ && isFinite(o);
}

function isBoolean(o) {
return typeof o === ‘boolean‘;
}
function isEmpty(o) {
if (!this.isString(o) && this.isValue(o)) {
return false;
} else if (!this.isValue(o)) {
return true;
}
o = $.trim(o).replace(/\&nbsp\;/ig, ‘‘).replace(/\&#160\;/ig, ‘‘);
return o === "";
}

function getContextPath(){
var href=window.location.href;
var host=window.location.host;
var origin=document.location.origin;
var f1=href.substring(href.indexOf(host));
var f2=f1.substring(f1.indexOf("/"));
var root=f2.split("/");
return "/" + root[1];
//return "/easweb";
}

js中判断空及获取当前服务的根路径

原文:http://www.cnblogs.com/mymelody/p/5619528.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!