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

  • 相关阅读:
    shell学习(15)- eval及shell No such file or directory解决办法
    30张图带你彻底理解红黑树
    linux中$@,$*,$0,$$,$?参数的含义
    QPS,TPS,吞吐量,响应时间详解及关系
    shell学习(14)- who
    SpringBoot 入门
    创建 Java 项目
    部分 GIT 命令
    Spark Executor Task 的执行和数量
    Ubuntu 18 单机安装 HDP 3
  • 原文地址:https://www.cnblogs.com/liubiqu/p/1307734.html
Copyright © 2011-2022 走看看