时间:2021-05-18
复制代码 代码如下:
//打开模态窗口
function dialog(obj){
if(obj.url == undefined || obj.url == null){
throw new Error("please set obj.url");
}
var url = obj.url;
if(url.indexOf("?")!=-1){
url = url+ "&r_=" + Math.random();
}else {
url = url+ "?r_=" + Math.random();
}
//alert(obj.width + "," + obj.height + "," + obj.top + "," + obj.left);
var w ;
if(!obj.width){
w = screen.width/2;
}else{
w = parseInt(obj.width);
}
var h ;
if(!obj.height){
h = 500;
}else{
h = parseInt(obj.height);
}
var t ;
if(!obj.top){
t = 50;
}else{
t = parseInt(obj.top);
}
var l;
if(!obj.left){
l = (screen.width - parseInt(w))/2;
}else{
l = parseInt(obj.left);
}
w = parseInt(w) + "px";
h = parseInt(h) + "px";
l = parseInt(l) + "px";
t = parseInt(t) + "px";
var paramStr = "";
paramStr += ("dialogHeight=" + h + ";");
paramStr += ("dialogWidth=" + w + ";");
if(obj.center != undefined && obj.center != null){
paramStr += "center=" + obj.center + ";"
}else{
paramStr += ("dialogTop=" + t + ";");
paramStr += ("dialogLeft=" + l + ";");
}
paramStr += "resizable=yes;scroll=yes";
//alert(paramStr);
var rv = window.showModalDialog(url,window,paramStr);
if (rv == undefined) {
rv = window.returnValue;
}
if(obj.cb){
return obj.cb.call(rv,rv);
}
return rv;
}
function openWin(u,w,h){
var obj = {
url : u,
width : w,
height : h
}
return dialog(obj);
}
function openWinWithCallBack(u,w,h,fun){
var obj = {
url : u,
width : w,
height : h,
cb : fun
}
return dialog(obj);
}
function openWindow(obj){
if(obj.url == undefined || obj.url == null){
throw new Error("please set obj.url");
}
var url = obj.url;
if(url.indexOf("?")!=-1){
url = url+ "&r_=" + Math.random();
}else {
url = url+ "?r_=" + Math.random();
}
//alert(obj.width + "," + obj.height + "," + obj.top + "," + obj.left);
var w ;
if(!obj.width){
w = screen.width/2;
}else{
w = parseInt(obj.width);
}
var h ;
if(!obj.height){
h = 500;
}else{
h = parseInt(obj.height);
}
var t ;
if(!obj.top){
t = 50;
}else{
t = parseInt(obj.top);
}
var l;
if(!obj.left){
l = (screen.width - parseInt(w))/2;
}else{
l = parseInt(obj.left);
}
w = parseInt(w);
h = parseInt(h);
l = parseInt(l);
t = parseInt(t);
//窗口句柄
var name;
if(!obj.name){
name = "win_" + new Date().getTime();
}else{
name = obj.name;
}
//alert(name);
//是否可以改变窗口大小
var resizable = obj.resizable || "no";
//是否有滚动条
var scrollbars= obj.scrollbars || "yes";
//是否有状态栏
var status = obj.status || "no";
//是否有菜单栏
var menubar = obj.menubar || "no";
//是否有工具栏
var toolbar = obj.toolbar || "no";
//是否有地址栏
var locations = obj.locations || "yes";
return window.open (url,name,"height=" + h + ",width=" + w + ",top=" + t + ",left=" + l + ",toolbar=" + toolbar + ",menubar=" + menubar + ",scrollbars=" + scrollbars + ", resizable=" + resizable + ",location=" + locations + ", status=" + status + ",hotkeys=esc");
}
//模态窗口打开模式的子页面获取父页面对象
function getParent(){
var p = "";
if (window.opener != undefined) {
p = window.opener;
}
else {
p = window.dialogArguments;
};
return p;
}
//模态窗口打开模式的子页面设置returnValue
function setReturnValue(v){
if (window.opener != undefined) {
window.opener.returnValue = v;
}
else {
window.returnValue = v;
};
}
//滑动门
function ScrollDoor(){
this.value = 0;
}
ScrollDoor.prototype = {
onlyMenu : function(menus,openClass,closeClass){ // only menu no have content
var _this = this;
for(var i = 0 ; i < menus.length ; i++)
{
_this.$(menus[i]).flag = ++this.value;
_this.$(menus[i]).value = i;
_this.$(menus[i]).onclick = function(){
for(var j = 0 ; j < menus.length ; j++)
{
_this.$(menus[j]).className = closeClass;
//_this.$(divs[j]).style.display = "none";
}
_this.$(menus[this.value]).className = openClass;
//_this.$(divs[this.value]).style.display = "block";
}
}
},
sd : function(menus,divs,openClass,closeClass){// two class
var _this = this;
if(menus.length != divs.length)
{
alert("菜单层数量和内容层数量不一样!");
return false;
}
for(var i = 0 ; i < menus.length ; i++)
{
_this.$(menus[i]).flag = ++this.value;
_this.$(menus[i]).value = i;
_this.$(menus[i]).onclick = function(){
for(var j = 0 ; j < menus.length ; j++)
{
_this.$(menus[j]).className = closeClass;
_this.$(divs[j]).style.display = "none";
}
_this.$(menus[this.value]).className = openClass;
_this.$(divs[this.value]).style.display = "block";
}
}
},
sd3class : function(menus,divs,openClass,closeClass,middleClass){ //three class
var _this = this;
for(var x = 0 ; x < menus.length ; x++)
{
_this.$(menus[x]).state = _this.$(menus[x]).className == openClass ? "open" : "close";
}
if(menus.length != divs.length)
{
alert("菜单层数量和内容层数量不一样!");
return false;
}
for(var i = 0 ; i < menus.length ; i++)
{
_this.$(menus[i]).flag = ++this.value;
_this.$(menus[i]).value = i;
_this.$(menus[i]).onclick = function(){
for(var j = 0 ; j < menus.length ; j++)
{
_this.$(menus[j]).className = closeClass;
_this.$(divs[j]).style.display = "none";
_this.$(menus[j]).state = "close";
}
this.state = "open";
_this.$(menus[this.value]).className = openClass;
_this.$(divs[this.value]).style.display = "block";
}
_this.$(menus[i]).onmouseover = function(){
//alert(this.state);
for(var j = 0 ; j < menus.length ; j++)
{
if(_this.$(menus[j]).state != "open")
{
_this.$(menus[j]).className = closeClass;
_this.$(menus[j]).state = "close";
}
}
if(this.state == "open")
{
}
else
{
this.className = middleClass;
}
}
_this.$(menus[i]).onmouseout = function(){
if(this.state != "open")
{
this.className = closeClass;
}
}
}
},
$ : function(oid){
if(typeof(oid) == "string")
return document.getElementById(oid);
return oid;
}
}
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
1、加快窗口弹出速度 WindowsVista系统在打开窗口时使用了动画效果,会影响打开窗口的速度,对内存较小的用户来说,改善的方法就是将动画效果关闭。
在开发中遇到需要在打开窗口的同时给父窗口添加遮罩防止用户误操作,而在窗口关闭时需要去掉父窗口的遮罩以便用户操作。所以可以利用setInterval()来周期性的
测试的时候,注意当前目录中,有代码中的html文件。复制代码代码如下:Windows窗口打开varwinID=null;//打开窗口functionopenWi
今天的小编就给大家分享一个在Win10中使用键盘快捷键快速调整窗口大小的方法。使用键盘快捷键调整窗口大小的方法:在打开窗口中,我们可以使用【Win+↑
今天我们就来看看LINUX中usermod来设置主组和附加组的方法,很简单,请看下文详细教程。1、打开LINUXUBUNTU操作系统,找到终端并且打开窗口。2、