几个常用的脚本写法
2008-10-10 08:51
579 查看
返回按钮的写法:(要求:如果是打开新窗口,则关闭窗口,否则就返回前一页或者指定页)
<input type="button" value="返回" onclick="try{if(typeof(window.opener)!='object'){location.href='WebQuery.aspx?repoid=78102';}else{window.close();}}catch(e){}" />
<input type="button" value="返回" onclick="try{if(typeof(window.opener)!='object'){history.back();}else{window.close();}}catch(e){}" />
OpenNewWindow("xxx.aspx");
OpenNewWindow("xxx.aspx",true);
//根据参数IsMax来决是否打开全屏窗口:IsMax为true打开全屏
function OpenNewWindow(strUrl, IsMax,isResize,widthPx,heightPx)
{
if (typeof(widthPx) == "undefined")
{
var widthPx=600;
}
if (typeof(lengthPx) == "undefined")
{
var heightPx=400;
}
if(typeof(isResize) == "undefined")
{
var isResize = 1;
}
if(typeof(IsMax) == "undefined")
{
var IsMax = true;
}
var strFeatures ="width="+widthPx+",height="+heightPx+",resizable="+isResize+",scrollbars=1,status=1,center=1";
newwin=window.open(strUrl,"",strFeatures)
if(IsMax)
{
if (document.all)
{
newwin.moveTo(0,0);
newwin.resizeTo(screen.width,screen.height);
newwin.outerWidth=screen.availWidth;
newwin.outerHeight=screen.availHeight;
newwin.focus();
return;
}
}
else
{
newwin.moveTo((window.screen.availWidth-widthPx)/2,(window.screen.availHeight-heightPx)/2);
newwin.resizeTo(widthPx,heightPx);
newwin.focus();
}
}
<input type="button" value="返回" onclick="try{if(typeof(window.opener)!='object'){location.href='WebQuery.aspx?repoid=78102';}else{window.close();}}catch(e){}" />
<input type="button" value="返回" onclick="try{if(typeof(window.opener)!='object'){history.back();}else{window.close();}}catch(e){}" />
OpenNewWindow("xxx.aspx");
OpenNewWindow("xxx.aspx",true);
//根据参数IsMax来决是否打开全屏窗口:IsMax为true打开全屏
function OpenNewWindow(strUrl, IsMax,isResize,widthPx,heightPx)
{
if (typeof(widthPx) == "undefined")
{
var widthPx=600;
}
if (typeof(lengthPx) == "undefined")
{
var heightPx=400;
}
if(typeof(isResize) == "undefined")
{
var isResize = 1;
}
if(typeof(IsMax) == "undefined")
{
var IsMax = true;
}
var strFeatures ="width="+widthPx+",height="+heightPx+",resizable="+isResize+",scrollbars=1,status=1,center=1";
newwin=window.open(strUrl,"",strFeatures)
if(IsMax)
{
if (document.all)
{
newwin.moveTo(0,0);
newwin.resizeTo(screen.width,screen.height);
newwin.outerWidth=screen.availWidth;
newwin.outerHeight=screen.availHeight;
newwin.focus();
return;
}
}
else
{
newwin.moveTo((window.screen.availWidth-widthPx)/2,(window.screen.availHeight-heightPx)/2);
newwin.resizeTo(widthPx,heightPx);
newwin.focus();
}
}
相关文章推荐
- 几个常用的Linux监控脚本
- 几个常用的Linux监控脚本
- 一些python脚本方面常用的写法,用来备忘
- 常用的几个shell脚本_2_查看日志
- 使用Spark分析拉勾网招聘信息(四): 几个常用的脚本与图片分析结果
- 整理的几个常用的数据库维护的脚本(ZT)
- 常用的几个正则表达式的写法
- 关于javascript脚本比较常用的几个方法
- 几个常用的Linux监控脚本
- 几个常用的Linux操作系统监控脚本
- 常用的几个监控脚本
- 几个常用的Linux监控脚本
- Linux几个常用的监控脚本
- 常用的几个shell脚本_3_恢复工程
- [工作笔记]几个常用的字符串处理脚本, 标记一下.
- 自己写的几个简单常用的脚本
- 几个常用的shell脚本
- 浅析几个CSS3常用功能的写法
- 几个常用的Linux监控脚本
- 几个简单常用的oracle权限查询脚本