JavaScript中如何设置或获取basePath变量?
- 内容介绍
- 文章标签
- 相关推荐
本文共计146个文字,预计阅读时间需要1分钟。
主要用来自替代表示jsp中经常使用的basePath+/**/,减少相对路径的使用,并增加basePath*+*项目上下文访问路径,例如:/myproject*+*@type {string}*+*/var projectPath=window.*+*;
/*
* 减少相对路径而添加的basePath
* 主要用来替代jsp中经常使用的basePath
* */
/**
* 项目上下文访问路径
* 如:/myproject
* @type {string}
*/
var projectPath = window.location.pathname == 'null'?'':window.location.pathname.substring(0,window.location.pathname.indexOf('/',1));
/**
* 服务器地址 如 : localhost:8080
* @type {string|Array|*|string|Array.
本文共计146个文字,预计阅读时间需要1分钟。
主要用来自替代表示jsp中经常使用的basePath+/**/,减少相对路径的使用,并增加basePath*+*项目上下文访问路径,例如:/myproject*+*@type {string}*+*/var projectPath=window.*+*;
/*
* 减少相对路径而添加的basePath
* 主要用来替代jsp中经常使用的basePath
* */
/**
* 项目上下文访问路径
* 如:/myproject
* @type {string}
*/
var projectPath = window.location.pathname == 'null'?'':window.location.pathname.substring(0,window.location.pathname.indexOf('/',1));
/**
* 服务器地址 如 : localhost:8080
* @type {string|Array|*|string|Array.

