js提交后关闭子窗口

来源:互联网 发布:轻量级c语言ide 编辑:程序博客网 时间:2024/04/30 15:50

[code=JScript][/code]
var xmlHttp = false;
  try{
  xmlHttp = new XMLHttpRequest();
  }catch(tryMicrosoft){
  try{
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
  }catch(otherMicorsoft){
  try{
  xmlHttp = new ActiveXObject("Micorsoft.XMLHTTP");
  }catch(otherChrome){
  xmlHttp = false;
  }
  }
  }

  var hasClosed;
  function closeWin(){
  hasClosed = true;
  window.opener.location="javascript:reloadPage();";
  window.opener = null;
  window.close();
  }

  window.onbeforeunload = function(){
  if(!hasClosed){//如果已经执行了closeWin方法,则不执行本方法
  window.opener.location="javascript:reloadPage();";
  }
  }

  function reloadPage(){
history.go(0);
document.execCommand("refresh")
document.location = document.location;
document.location.reload();
}

   
  function addSeed(parmater){
  if(parmater == '2'){
  if (confirm("登记确认后将不能进行任何操作,是否继续?")){
  document.forms[0].action = "<%=request.getContextPath()%>/product/tjgl.do?method=tj_addimport&savep=" + parmater;
  closeWin();
  }else{
  url = "";
  }
  }else{
  document.forms[0].action = "<%=request.getContextPath()%>/product/tjgl.do?method=tj_addimport&savep=" + parmater;
  closeWin();
  }
  }

原创粉丝点击