`
zhy584520
  • 浏览: 181084 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

常用js代码

阅读更多

返回上一页并刷新:window.location.href=document.referrer;

返回上一页不刷新:window.history.go(-1);

弹出模式窗口,并返回值给父窗口接收:

父窗口中JS代码如下:

var result=showModalDialog('selectSalesman.aspx','subpage','dialogWidth:760px;dialogHeight:500px;center:yes;help:no;resizable:no;status:no'); //打开模态子窗体,并获取返回值
document.getElementById("txUsername").value=result.split("'")[0]; //返回值分别赋值给相关文本框

 

 

子窗口中JS代码如下:

          <script type="text/javascript">
            function selectvalue(username)
            {
                window.returnValue=username; //返回值 
                window.close(); 
            }
          </script>

 

屏幕javascript错误,遇到错误以后,后面的代码可以正常的运行下去。

 window.onerror=function(){return true;};

判断父窗体是否关闭

 if(typeof(window.opener.document)=='unknown' ||typeof(window.opener.document) == 'undefined')

     { 
      //已关闭
}else{
        opener.MySeekOk(); 
     } 
   } 

 暂时就写到这吧。有空继续完善.....

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics