📄 global.js
字号:
/**
* Mr.Fang QQ:184377367 www.ebycms.com
* Global.js
*/
$F = function(oFw){ return document.getElementById(oFw).value; }
$N = function(em){ return document.getElementsByName(em); }
$ = function(em) {
if (document.getElementById){ return document.getElementById(em); }
else if (document.all){ return document.all[em]; }
else if (document.layers){ return document.layers[em]; }
else{ return null; }
}
function getClass(o)
{
return o.className;
}
function setClass(o,strClassName)
{
o.setAttribute('class', strClassName);
}
function createAjax(){
if (window.XMLHttpRequest) {
oAjax = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
try {
oAjax = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
oAjax = new ActiveXObject("Micrsost.XMLHTTP");
} catch(e){}
}
}
}
function createAjaxs(){
if (window.XMLHttpRequest) {
aj = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
try {
aj = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
aj = new ActiveXObject("Micrsost.XMLHTTP");
} catch(e){}
}
}
}
function alertWin(title, w, h ,strFurl,intFw,intFh){
var titleheight = "10px"; // 窗口标题高度
var bordercolor = "#709CD2"; // 提示窗口的边框颜色
var titlecolor = "#FFFFFF"; // 窗口标题颜色
var titlebgcolor = "#709CD2"; // 窗口标题背景色
var bgcolor = "#FFFFFF"; // 提示内容的背景色
var iWidth = document.documentElement.clientWidth;
var iHeight = document.documentElement.clientHeight;
var bgObj = document.createElement("div");
bgObj.style.cssText = "position:absolute;left:0px;top:0px;width:"+iWidth+"px;height:"+Math.max(document.body.clientHeight, iHeight)+"px;filter:Alpha(Opacity=30);opacity:0.3;background-color:#000000;z-index:101;";
document.body.appendChild(bgObj);
var msgObj=document.createElement("div");
msgObj.style.cssText = "position:absolute;font:11px '宋体';top:"+(iHeight-h)/2+"px;left:"+(iWidth-w)/2+"px;width:"+w+"px;height:"+h+"px;text-align:center;border:1px solid "+bordercolor+";background-color:"+bgcolor+";padding:1px;line-height:22px;z-index:102;";
var htmlCouent = "<iframe width='"+intFw+"'% style='height:"+intFh+"px;' name='regF' id='regF' src='"+strFurl+"' frameborder='0' scrolling='no'></iframe>";
document.body.appendChild(msgObj);
//msgObj.innerHTML = htmlCouent;
var table = document.createElement("table");
msgObj.appendChild(table);
table.style.cssText = "margin:0px;border:0px;padding:0px;";
table.cellSpacing = 0;
var tr = table.insertRow(-1);
var titleBar = tr.insertCell(-1);
titleBar.style.cssText = "width:100%;height:"+titleheight+"px;text-align:left;padding:3px;margin:0px;font:bold 13px '宋体';color:"+titlecolor+";border:1px solid " + bordercolor + ";cursor:move;background-color:" + titlebgcolor;
titleBar.style.paddingLeft = "10px";
titleBar.innerHTML = title;
var moveX = 0;
var moveY = 0;
var moveTop = 0;
var moveLeft = 0;
var moveable = false;
var docMouseMoveEvent = document.onmousemove;
var docMouseUpEvent = document.onmouseup;
titleBar.onmousedown = function() {
var evt = getEvent();
moveable = true;
moveX = evt.clientX;
moveY = evt.clientY;
moveTop = parseInt(msgObj.style.top);
moveLeft = parseInt(msgObj.style.left);
document.onmousemove = function() {
if (moveable) {
var evt = getEvent();
var x = moveLeft + evt.clientX - moveX;
var y = moveTop + evt.clientY - moveY;
if ( x > 0 &&( x + w < iWidth) && y > 0 && (y + h < iHeight) ) {
msgObj.style.left = x + "px";
msgObj.style.top = y + "px";
}
}
};
document.onmouseup = function () {
if (moveable) {
document.onmousemove = docMouseMoveEvent;
document.onmouseup = docMouseUpEvent;
moveable = false;
moveX = 0;
moveY = 0;
moveTop = 0;
moveLeft = 0;
}
};
}
var closeBtn = tr.insertCell(-1);
closeBtn.style.cssText = "cursor:pointer; padding:2px;background-color:" + titlebgcolor;
closeBtn.innerHTML = "<span style='font-size:15pt; color:"+titlecolor+";'><img src='View/sking/04/images/dialogclose.gif'></span>";
closeBtn.onclick = function(){
document.body.removeChild(bgObj);
document.body.removeChild(msgObj);
}
var msgBox = table.insertRow(-1).insertCell(-1);
msgBox.style.cssText = "font:10pt '宋体';";
msgBox.colSpan = 2;
msgBox.innerHTML = htmlCouent;
// 获得Event对象,用于兼容IE和FireFox
function getEvent() {
return window.event || arguments.callee.caller.arguments[0];
}
}
function do_alert( msg ){
var _height = document.documentElement.clientHeight||document.body.clientHeight;
var _top = (_height) ? (_height - 39)/2 + document.documentElement.scrollTop : 0;
var msgObj=document.createElement('div');
msgObj.setAttribute('id', 'msgInfo');
msgObj.setAttribute('align', 'center');
msgObj.style.position = 'absolute';
msgObj.style.top = _top + 'px';
msgObj.style.left = '0';
msgObj.style.width = '100%';
msgObj.style.height = '33px';
msgObj.style.zIndex = '999';
msgObj.innerHTML = '<span id="alert">'+ msg +'</span>';
document.body.appendChild(msgObj);
setTimeout('close_alert()', 3000);
}
function close_alert(){
document.body.removeChild($('msgInfo'));
}
function selectAll(o){
for(var i=0;i<$N(o).length;i++) {
$N(o)[i].checked=true;
}
}
function selectBack(o){
for(var i=0;i<$N(o).length;i++) {
$N(o)[i].checked==true?$N(o)[i].checked=false:$N(o)[i].checked=true;
}
}
function kk(o,p)
{
var intChildLen = $(o).childNodes.length;
for (i=0;i<=intChildLen;i++)
{
var obj = $(o).childNodes[i];
obj.style.display='block';
}
}
function jumpPege(strPage, intCid, oTag){
intCid == ''?0:intCid;
var intPageNum = oTag.options[oTag.selectedIndex].value;
var strUrl = location.href;
if (strPage==1){
location.href='?do=cls&cid='+intCid+'&page='+intPageNum;
} else if (strPage==2){
location.href='?do=SplList&sid='+intCid+'&page='+intPageNum;
} else if (strPage==3){
var strCut = strUrl.match(/key(=+)[0-9a-zA-Z\u4e00-\u9fa5]*/g);
var arrPar = strCut[0].split('=');
location.href='?do=so&key='+arrPar[1]+'&page='+intPageNum;
} else if (strPage==4){
if ( strUrl.indexOf('best=true')!=-1 ){
location.href='?do=splmenu&cid='+intCid+'&best=true&page='+intPageNum;
} else {
if ( strUrl.indexOf('top=true')!=-1 ){
location.href='?do=splmenu&cid='+intCid+'&top=true&page='+intPageNum;
} else {
location.href='?do=splmenu&cid='+intCid+'&page='+intPageNum;
}
}
}
}
function setOrder(intClsId, intOrder, strBest, strTop,strPar){
var strUrl_a = strBest!='false' ? '&best='+strBest : '';
var strUrl_b = strTop!='false' ? '&top='+strTop : '';
if (strPar==1){
location.href='?do=SplList&sid='+intClsId+'&order='+intOrder+strUrl_a+strUrl_b;
} else if (strPar==2) {
location.href='?do=cls&cid='+intClsId+'&order='+intOrder+strUrl_a+strUrl_b;
} else if (strPar==3) {
location.href='?do=cls&cid='+intClsId+'&order='+intOrder+strUrl_a+strUrl_b;
} else if (strPar==4) {
location.href='?do=splmenu&cid='+intClsId+'&order='+intOrder+strUrl_a+strUrl_b;
}
}
function cus(o)
{
o.style.cursor='hand';
}
function soSaveText(em){
var v = em.value;
setTimeout('soDelText()',4000);
}
function soDelText(){
$('q').value=intMusicCount;
}
function soKeyPress(em){
if(event.keyCode==13 && $('q').value !='')
{
location.href='?do=so&key='+em.value;
}
}
function getCookie(strName){
var arrCut = document.cookie.split(';');
var arrCutLen = arrCut.length;
for (i=0;i<arrCutLen;i++){
var strTm = arrCut[i];
if (strTm.indexOf(strName)!=-1 && strTm.indexOf('[url]')!=-1){
var arrCut_2 = strTm.split('=');
var u = arrCut_2[1];
return u;
}
}
}
function killErrors() { return true; } window.onerror = killErrors;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -