?? window.js
字號:
/**
* 打開打印窗口
* url:鏈接頁面或action動作
* 姜敏
*/
function printWindow(url){
var sURL = url;
var sFeatures = "toolbar=no, menubar=no, scrollbars=no,resizable=yes, "
+ "location=no, status=no, titlebar=no, width=800, height=600, top=100, left=100";
window.open(sURL,'notoolbar'+randomNum(),sFeatures);
}
function exportWindow(url){
var sURL = url;
var sFeatures = "toolbar=no, menubar=no, scrollbars=no,resizable=yes, "
+ "location=no, status=no, titlebar=no, width=800, height=600, top=50, left=50";
var objwin=window.open(sURL,'export'+randomNum(),sFeatures);
objwin.close();
}
/**
* 打開模態窗口
* url:鏈接頁面或action動作
* width:打開模態窗口的寬度
* height:打開模態窗口的高度
* 注意:打開模態窗口的頁面中要在<head>后面加上
* <meta http-equiv="Pragma" content="no-cache">:禁止模態窗口緩存
* <base target="_self"/>:模態窗口中的表單在本窗口中提交
* <a onClick='window.location = "view-source:" + window.location.href'><b>源文件</b></a> 可以查看模態窗口的源文件
* 姜敏
*/
function modalWindow(url, width, height){
var sURL = url;
var sFeatures = "dialogWidth:" + width + "px; dialogHeight:" + height + "px; "
+ "help:no; scroll:no; center:yes; status:no;resizable:yes";
window.showModalDialog(sURL, window, sFeatures);
}
/**
* 打開普通窗口
* url:鏈接頁面或action動作
* width:寬度
* height:高度
* 姜敏
*/
function openWindow(url, width, height){
var sURL=url;
var sFeatures = "scrollbars=yes, status=yes, resizable=yes,"
+ "toolbar=yes, menubar=yes, location=yes, titlebar=yes"
if(width!=null){
sFeatures+=", width="+width;
}
if(height!=null){
sFeatures+=", height="+height;
}
window.open(sURL, 'open'+randomNum(), sFeatures);
}
/**
* 打開窗口
* url:鏈接頁面或action動作
* width:寬度
* height:高度
*/
function openNoBarWindow(url, width, height){
var sURL=url;
var sFeatures = "scrollbars=no, status=no, resizable=no,"
+ "toolbar=no, menubar=no, location=no, titlebar=no"
if(width!=null){
sFeatures+=", width="+width;
sFeatures+=", left="+(screen.width-width)/2;
}
if(height!=null){
sFeatures+=", height="+height;
sFeatures+=", top="+(screen.height-height-100)/2;
}
window.open(sURL, 'openNoBar'+randomNum(), sFeatures);
}
/**
* 打開全屏窗口
* url:鏈接頁面或action動作
* 姜敏
*/
function openFullWindow(url){
var sURL=url;
var sFeatures = "toolbar=no, menubar=no, scrollbars=no, resizable=yes, "
+ "location=no, status=no, titlebar=no, width="+(screen.width-10)+", "
+ "height="+(screen.height-60)+", top=0, left=0";
window.open(sURL, 'full'+randomNum(), sFeatures);
}
/**
* 打開主窗口
* url:鏈接頁面或action動作
* 姜敏
*/
function openMainWindow(url){
var sURL=url;
var sFeatures = "toolbar=no, menubar=no, scrollbars=no, resizable=yes, "
+ "location=no, status=no,titlebar=no, width="+(screen.width-10)+", "
+ "height="+(screen.height-60)+", top=0, left=0";
window.open(sURL, 'main', sFeatures);
}
/**
* 設置鏈接
* url:連接的jsp頁面或action動作
* 姜敏
*/
function link(url, frameID){
if(frameID==null){
window.location.href = url;
}
else{
window.frames[frameID].location = url
}
}
/**
* 回車代替tab
* 姜敏
*/
function handleKey(){
var gk = window.event.keyCode;
if (gk==13) {
if(window.event.srcElement.tagName!='TEXTAREA'){
window.event.keyCode=9;
return;
}
}
}
/**
* 打開虛擬窗口
* src: 請求動作
* title: 虛擬窗口的標題
* width: 窗口寬度
* height: 窗口高度
*/
function openVirtualWindow(src, width, height, closeFunction){
var objSpans = window.document.body.getElementsByTagName("SPAN");
for(var i=objSpans.length; i>0; i--){
if(objSpans[i-1].className=='2k3Window'){
window.document.body.removeChild(objSpans[i-1]);
}
}
var bodyClientWidth = window.document.body.clientWidth;
var bodyClientHeight = window.document.body.clientHeight;
var bodyScrollTop = window.document.body.scrollTop;
var bodyScrollLeft = window.document.body.scrollLeft;
var tmpWidth=bodyClientWidth-width;
var tmpHeight=bodyClientHeight-height;
var left=(tmpWidth>0)? bodyScrollLeft+tmpWidth/2: bodyScrollLeft;
var top=(tmpHeight>0)? bodyScrollTop+tmpHeight/2: bodyScrollTop;
var objSpan = window.document.createElement("SPAN");
objSpan.width = width;
objSpan.height = height;
objSpan.left = left;
objSpan.top = top;
if(closeFunction!=null){
objSpan.closeFunction = closeFunction ;
}
objSpan.src = src;
objSpan.className = "2k3Window";
window.document.body.appendChild(objSpan);
return objSpan;
}
/**
* 打開虛擬窗口顯示消息
* src: 請求動作
* title: 虛擬窗口的標題
* width: 窗口寬度
* height: 窗口高度
*/
function openVirtualMessageWindow(message, title, width, height, closeFunction){
var objSpans = window.document.body.getElementsByTagName("SPAN");
for(var i=objSpans.length; i>0; i--){
if(objSpans[i-1].className=='2k3Window'){
window.document.body.removeChild(objSpans[i-1]);
}
}
var bodyClientWidth = window.document.body.clientWidth;
var bodyClientHeight = window.document.body.clientHeight;
var bodyScrollTop = window.document.body.scrollTop;
var bodyScrollLeft = window.document.body.scrollLeft;
var tmpWidth=bodyClientWidth-width;
var tmpHeight=bodyClientHeight-height;
var left=(tmpWidth>0)? bodyScrollLeft+tmpWidth/2: bodyScrollLeft;
var top=(tmpHeight>0)? bodyScrollTop+tmpHeight/2: bodyScrollTop;
var objSpan = window.document.createElement("SPAN");
objSpan.style.display = "none";
objSpan.caption = "title";
objSpan.innerHTML = message;
objSpan.width = width;
objSpan.height = height;
objSpan.left = left;
objSpan.top = top;
if(closeFunction!=null){
objSpan.closeFunction = closeFunction ;
}
objSpan.className = "2k3Window";
window.document.body.appendChild(objSpan);
}
function closeVirtualWindow(){
var windowSpan = window.parent.document.getElementById(window.name).parentElement;
window.parent.document.body.removeChild(windowSpan);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -