js弹出框,禁刷新

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>a</title>
<SCRIPT langauge='javasript'>
//禁止用F5键          
function document.onkeydown()          
{          
          if     (     event.keyCode==116)          
            {          
                    event.keyCode     =     0;          
                    event.cancelBubble     =   true;          
                  return   false;          
            }          
}          
           
//禁止右键弹出菜单          
function  document.oncontextmenu()          
{          
      return   false;          
}      
function openwin(url) {
var cw=window.open(url, "", "height=screen.height, width=screen.width, top=0,left=0 , toolbar =no, menubar=no, scrollbars=no, resizeable=no, location=no, status=no");
cw.resizeTo(screen.width,screen.height);cw.moveTo(0,0);window.opener=null;window.open('', '_self'); window.close();
}   
</SCRIPT>
</head>
<body onload="openwin('test.html')">
</body>
</html>

备注:ie8下才有效 window.opener=null;window.open('', '_self'); window.close();关闭该窗口,不弹出提示框

window.open()参数详解  

JQuery弹出层效果制作 JQuery插件TipsWindown 1.1 http://www.nowamagic.net/jquery/jquery_JqueryPopup.php
location.href的用法 http://www.cnblogs.com/chinafine/articles/1831445.html

 *.location.href 用法:
  top.location.href=”url”          在顶层页面打开url(跳出框架)
  self.location.href=”url”         仅在本页面打开url地址
  parent.location.href=”url”      在父窗口打开Url地址
  this.location.href=”url”       用法和self的用法一致
     if (top.location == self.location) 判断当前location 是否为顶层来 禁止frame引用


<link href="./css/tipswindown.css" rel="stylesheet">   
<script src="./js/tipswindown.js"></script>
<script src="../js/jquery-1.7.2.min.js"></script>  //上上级

<script>

        function openViewAllVoice1(){
            //parent.location.href="check_time_arrange.html";
//location.href="check_time_arrange.html";
            tipsWindown("批量审核","iframe:pass_or_not.html","350","300","true","","true","leotheme");
            
        }
</script>

//页面的跳转。 如果button是submit类型,必须用嵌入跳转
  <button class="btn-primary btn btntext-top" onClick="openViewAllVoice1();">批量审核</button>
<button type="submit" class="btn-primary btn btntext-top" style="margin-left:33%;margin-top:-1px;"  onClick="window.location.reload('project_check.html');">保存</button>
//关闭子窗口,并且刷新  window.parent.location.reload();

posted @ 2013-08-02 16:11  墙头一颗草  Views(257)  Comments(0Edit  收藏  举报