zoukankan      html  css  js  c++  java
  • 几个常用的脚本写法

    返回按钮的写法:(要求:如果是打开新窗口,则关闭窗口,否则就返回前一页或者指定页)

    <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();
     }
    }

  • 相关阅读:
    架构师之路(4)详解面向对象 王泽宾 (转)
    输出螺旋矩阵(一)
    输出螺旋矩阵(三)
    excel sheet中数据的快速复制
    计算数组的维数
    不绑定记录集获取datagrid某行某列的内容
    API判断数组是否为空
    将某网页的某框架内容显示在WEBBROWSER中
    输出螺旋矩阵(二)
    快速删除一个包含文件和子文件夹的文件夹
  • 原文地址:https://www.cnblogs.com/liubiqu/p/1307734.html
Copyright © 2011-2022 走看看