返回按钮的写法:(要求:如果是打开新窗口,则关闭窗口,否则就返回前一页或者指定页)
<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();
}
}