//----------------------------------------------------------------------------------------
|
// 功能:初始化定义SGWorld70 SGWorld701
|
// 赵贺 2018.06.01.
|
//----------------------------------------------------------------------------------------
|
function CreateSGObj() {
|
try {
|
var obj = document.getElementById("SGWorld");
|
if (obj == null) {
|
obj = document.createElement('object');
|
obj.setAttribute("name", "SGWorld");
|
obj.setAttribute("id", "SGWorld");
|
obj.style.height = "1px";
|
obj.style.width = "1px";
|
obj.setAttribute("classid", "CLSID:3A4F919C-65A8-11D5-85C1-0001023952C1");
|
|
document.body.appendChild(obj);
|
}
|
return obj;
|
} catch (e) {
|
alert(e);
|
}
|
}
|
|
//----------------------------------------------------------------------------------------
|
// 功能:获取相对路径
|
// 赵贺 2018.06.01.
|
//----------------------------------------------------------------------------------------
|
function abspath() {
|
var abspath = unescape(window.location.href);
|
|
// Remove query String
|
var index = abspath.indexOf("?");
|
if (index > 0) abspath = abspath.substr(0, index - 1);
|
|
index = abspath.lastIndexOf("/");
|
var index2 = abspath.lastIndexOf("\\");
|
|
index = (index > index2) ? index : index2;
|
if (index <= 0) return abspath;
|
|
abspath = abspath.substring(0, index);
|
|
if (abspath.substring(0, 1) == "/") abspath = abspath.slice(1);
|
|
var re = /file:\/\/\//gi;
|
if (abspath.match(re) != null) abspath = abspath.replace(re, ""); // if this is indeed a local file, we strip the "file://" prefix from it.
|
|
return (abspath);
|
}
|