var path = getRootPath(); function getRootPath() { // 获取当前网址,如: http://localhost:8083/uimcardprj/share/meun.jsp var curWwwPath = window.document.location.href; // 获取主机地址之后的目录,如: uimcardprj/share/meun.jsp var pathName = window.document.location.pathname; var pos = curWwwPath.indexOf(pathName); // 获取主机地址,如: http://localhost:8083 var localhostPaht = curWwwPath.substring(0, pos); // 获取带"/"的项目名,如:/uimcardprj var projectName = pathName .substring(0, pathName.substr(1).indexOf('/') + 1); if(projectName == "/shwzhtweb"){ return (localhostPaht + projectName); }else{ return localhostPaht; } } /*** * 根据url路径 跳转页面 * * **/ function goUrl(urlPath){ window.location.href = urlPath; } function openUrl(urlPath){ window.open(urlPath); } function openUrlLog(urlPath,content){ window.open(urlPath); $.ajax({ type : 'POST', url : path + "/userlog/userJspLog.action", data : { 'shjspLog.url' : urlPath, 'shjspLog.content' : content }, success : function(msg) { } }); } function openUrlLogRecordid(urlPath,content,recordid,lx){ window.open(urlPath); $.ajax({ type : 'POST', url : path + "/userlog/userJspLog.action", data : { 'shjspLog.url' : urlPath, 'shjspLog.content' : content, 'shjspLog.recordid' : recordid, 'shjspLog.lx' : lx }, success : function(msg) { } }); } function goUrlLog(urlPath,content){ window.location.href = urlPath; $.ajax({ type : 'POST', url : path + "/userlog/userJspLog.action", data : { 'shjspLog.url' : urlPath, 'shjspLog.content' : content }, success : function(msg) { } }); } /******************************************************************************* * ajax post 请求 */ function ajaxpost(map1, url1, name) { var data1 = { str : map1 } $.ajax({ type : 'POST', url : path + url1, data : data1, success : function(msg) { if(name=="setMtcnSelect"){ setMtcnSelect(msg); }else if(name = "setMenuSearch"){ setMenuSearch(msg); } } }); } /**** * ajax请求 无返回值 * @param map1 * @param url1 */ function ajaxpost1(map1,url1){ var data1 = { str:map1 } $.ajax({ type:'POST', url:path+url1, data:data1 }); } /**隐藏***/ function hide(id){ $('#'+id).hide(); } /**显示***/ function show(id){ $('#'+id).show(); }