如何去掉ie里面的关闭按钮,和屏蔽ALT+F4 (转载)

简介:

None.gif 去掉关闭按钮 可以使用无边框窗口设计,不过IE6中已经不支持了。。。
ExpandedBlockStart.gif
< script  language =javascript >
InBlock.gifminimizebar
="ftp/minimize.gif"; '最小化图片路径
InBlock.gifminimizebar2
="ftp/minimize2.gif"; '点击最小化图片路径
InBlock.gifclosebar
="ftp/close.gif"; '关闭图片路径 
InBlock.gifclosebar2
="ftp/close2.gif"; '点击关闭图片路径 
InBlock.gificon
="ftp/icon.gif"; '右边icon图片路径 
InBlock.gif
InBlock.gif
function noBorderWin(fileName,w,h,titleBg,moveBg,titleColor,titleWord,scr) //定义一个弹出无边窗口的函数,能数意义见下面“参数说明”,实际使用见最后的实例。
InBlock.gif

ExpandedSubBlockStart.gif
{
InBlock.gif
var contents="<html>"+
InBlock.gif
"<head>"+
InBlock.gif
"<title>"+titleWord+"</title>"+
InBlock.gif
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">"+
InBlock.gif
"<object id=hhctrl type='application/x-oleobject' classid='clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11'><param name='Command' value='minimize'></object>"+
InBlock.gif
"</head>"+
InBlock.gif
"<body topmargin=0 leftmargin=0 scroll=no onselectstart='return false' ondragstart='return false'>"+
InBlock.gif
" <table height=100% width=100% cellpadding=0 cellspacing=1 bgcolor="+titleBg+" id=mainTab>"+
InBlock.gif
" <tr height=18 style=cursor:default; onmousedown='x=event.x;y=event.y;setCapture();mainTab.bgColor=\""+moveBg+"\";' onmouseup='releaseCapture();mainTab.bgColor=\""+titleBg+"\";' onmousemove='if(event.button==1)self.moveTo(screenLeft+event.x-x,screenTop+event.y-y);'>"+
InBlock.gif
" <td width=18 align=center><img height=12 width=12 border=0 src="+icon+"></td>"+
InBlock.gif
" <td width="+w+"><span style=font-size:12px;color:"+titleColor+";font-family:宋体;position:relative;top:1px;>"+titleWord+"</span></td>"+
InBlock.gif
" <td width=14><img border=0 width=12 height=12 alt=最小化 src="+minimizebar+" onmousedown=hhctrl.Click(); onmouseover=this.src='"+minimizebar2+"' onmouseout=this.src='"+minimizebar+"'></td>"+
InBlock.gif
" <td width=13><img border=0 width=12 height=12 alt=关闭 src="+closebar+" onmousedown=self.close(); onmouseover=this.src='"+closebar2+"' onmouseout=this.src='"+closebar+"'></td>"+
InBlock.gif
" </tr>"+
InBlock.gif
" <tr height=*>"+
InBlock.gif
" <td colspan=4>"+
InBlock.gif
" <iframe name=nbw_v6_iframe src="+fileName+" scrolling="+scr+" width=100% height=100% frameborder=0></iframe>"+
InBlock.gif
" </td>"+
InBlock.gif
" </tr>"+
InBlock.gif
" </table>"+
InBlock.gif
"</body>"+
InBlock.gif
"</html>";
InBlock.gif
InBlock.gifpop
=window.open("","_blank","fullscreen=yes");
InBlock.gifpop.resizeTo(w,h);
InBlock.gifpop.moveTo((screen.width
-w)/2,(screen.height-h)/2);
InBlock.gifpop.document.writeln(contents);
InBlock.gif
InBlock.gif
if(pop.document.body.clientWidth!=w||pop.document.body.clientHeight!=h) //如果无边窗口不是出现在纯粹的IE窗口中
ExpandedSubBlockStart.gif
{
InBlock.giftemp
=window.open("","nbw_v6");
InBlock.giftemp.close();
InBlock.gifwindow.showModalDialog(
"about:<"+"script language=javascript>window.open('','nbw_v6','fullscreen=yes');window.close();"+"</"+"script>","","dialogWidth:0px;dialogHeight:0px");
InBlock.gifpop2
=window.open("","nbw_v6");
InBlock.gifpop2.resizeTo(w,h);
InBlock.gifpop2.moveTo((screen.width
-w)/2,(screen.height-h)/2);
InBlock.gifpop2.document.writeln(contents);
InBlock.gifpop.close();
ExpandedSubBlockEnd.gif}

ExpandedBlockEnd.gif}

None.gif
</ script >
None.gif
None.gif你在您的link中要这样写
None.gifonclick="noBorderWin('xxx.asp','宽','高','#000000','#333333','#CCCCCC','名字','yes')"
None.gif
None.gif
None.gif屏蔽Alt+F4等快捷键:
ExpandedBlockStart.gif
< script >
ExpandedSubBlockStart.gif
function KeyDown()//屏蔽鼠标右键、Ctrl+n、shift+F10、F5刷新、退格键
InBlock.gif
 //alert("ASCII代码是:"+event.keyCode);
InBlock.gif
  if ((window.event.altKey)&&
InBlock.gif      ((window.event.keyCode
==37)||   //屏蔽 Alt+ 方向键 ←
ExpandedSubBlockStart.gif
       (window.event.keyCode==39))){  //屏蔽 Alt+ 方向键 →
InBlock.gif
     alert("不准你使用ALT+方向键前进或后退网页!");
InBlock.gif     event.returnValue
=false;
ExpandedSubBlockEnd.gif     }

InBlock.gif  
if ((event.keyCode==8)  ||                 //屏蔽退格删除键
InBlock.gif
      (event.keyCode==116)||                 //屏蔽 F5 刷新键
InBlock.gif
      (event.keyCode==112)||                 //屏蔽 F1 刷新键
ExpandedSubBlockStart.gif
      (event.ctrlKey && event.keyCode==82))//Ctrl + R
InBlock.gif
     event.keyCode=0;
InBlock.gif     event.returnValue
=false;
ExpandedSubBlockEnd.gif     }

InBlock.gif  
if ((event.ctrlKey)&&(event.keyCode==78))   //屏蔽 Ctrl+n
InBlock.gif
     event.returnValue=false;
InBlock.gif  
if ((event.shiftKey)&&(event.keyCode==121)) //屏蔽 shift+F10
InBlock.gif
     event.returnValue=false;
InBlock.gif  
if (window.event.srcElement.tagName == "A" && window.event.shiftKey) 
InBlock.gif      window.event.returnValue 
= false;  //屏蔽 shift 加鼠标左键新开一网页
ExpandedSubBlockStart.gif
  if ((window.event.altKey)&&(window.event.keyCode==115))//屏蔽Alt+F4
InBlock.gif
      window.showModelessDialog("about:blank","","dialogWidth:1px;dialogheight:1px");
ExpandedSubBlockEnd.gif      
return false;}

ExpandedSubBlockEnd.gif}

ExpandedSubBlockStart.gif
function Showhelp(){
InBlock.gif alert(
"Wrong!");
InBlock.gif 
return false;
ExpandedSubBlockEnd.gif}

ExpandedBlockEnd.gif 
</ script >
None.gif
None.gif
None.gif
None.gif 无边框窗口代码 
None.gif//第一步:把如下代码加入
< head ></ head > 区域中 
ExpandedBlockStart.gif
< script  language =javascript >  
InBlock.gifminimizebar
="minimize.gif"//视窗右上角最小化「按钮」的图片 
InBlock.gif
minimizebar2="minimize2.gif"//滑鼠悬停时最小化「按钮」的图片 
InBlock.gif
closebar="close.gif"//视窗右上角关闭「按钮」的图片 
InBlock.gif
closebar2="close2.gif"//滑鼠悬停时关闭「按钮」的图片 
InBlock.gif
icon="icon.gif"//视窗左上角的小图标 
InBlock.gif

InBlock.gif
function noBorderWin(fileName,w,h,titleBg,moveBg,titleColor,titleWord,scr) //定义一个弹出无边视窗的函数,能数意义见下面「参数说明」,实际使用见最後的实例。 
ExpandedSubBlockStart.gif
/* 
InBlock.gif------------------参数说明------------------- 
InBlock.giffileName :无边视窗中显示的文件。 
InBlock.gifw     :视窗的宽度。 
InBlock.gifh     :视窗的高度。 
InBlock.giftitleBg :视窗「标题栏」的背景色以及视窗边框颜色。 
InBlock.gifmoveBg :视窗拖动时「标题栏」的背景色以及视窗边框颜色。 
InBlock.giftitleColor :视窗「标题栏」文字的颜色。 
InBlock.giftitleWord :视窗「标题栏」的文字。 
InBlock.gifscr :是否出现卷轴。取值yes/no或者1/0。 
InBlock.gif-------------------------------------------- 
ExpandedSubBlockEnd.gif
*/
 
ExpandedSubBlockStart.gif

InBlock.gif
var contents="<html>"+ 
InBlock.gif
"<head>"+ 
InBlock.gif
"<title>"+titleWord+"</title>"+ 
InBlock.gif
"<META http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">"+ 
InBlock.gif
"<object id=hhctrl type='application/x-oleobject' classid='clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11'><param name='Command' value='minimize'></object>"+ 
InBlock.gif
"</head>"+ 
InBlock.gif
"<body topmargin=0 leftmargin=0 scroll=no onselectstart='return false' ondragstart='return false'>"+ 
InBlock.gif
" <table height=100% width=100% cellpadding=0 cellspacing=1 bgcolor="+titleBg+" id=mainTab>"+ 
InBlock.gif
" <tr height=18 style=cursor:default; onmousedown='x=event.x;y=event.y;setCapture();mainTab.bgColor=\""+moveBg+"\";' onmouseup='releaseCapture();mainTab.bgColor=\""+titleBg+"\";' onmousemove='if(event.button==1)self.moveTo(screenLeft+event.x-x,screenTop+event.y-y);'>"+ 
InBlock.gif
" <td width=18 align=center><img height=12 width=12 border=0 src="+icon+"></td>"+ 
InBlock.gif
" <td width="+w+"><span style=font-size:12px;color:"+titleColor+";font-family:宋体;position:relative;top:1px;>"+titleWord+"</span></td>"+ 
InBlock.gif
" <td width=14><img border=0 width=12 height=12 alt=最小化 src="+minimizebar+" onmousedown=hhctrl.Click(); onmouseover=this.src='"+minimizebar2+"' onmouseout=this.src='"+minimizebar+"'></td>"+ 
InBlock.gif
" <td width=13><img border=0 width=12 height=12 alt=关闭 src="+closebar+" onmousedown=self.close(); onmouseover=this.src='"+closebar2+"' onmouseout=this.src='"+closebar+"'></td>"+ 
InBlock.gif
" </tr>"+ 
InBlock.gif
" <tr height=*>"+ 
InBlock.gif
" <td colspan=4>"+ 
InBlock.gif
" <iframe name=nbw_v6_iframe src="+fileName+" scrolling="+scr+" width=100% height=100% frameborder=0></iframe>"+ 
InBlock.gif
" </td>"+ 
InBlock.gif
" </tr>"+ 
InBlock.gif
" </table>"+ 
InBlock.gif
"</body>"+ 
InBlock.gif
"</html>"
InBlock.gifpop
=window.open("","_blank","fullscreen=yes"); 
InBlock.gifpop.resizeTo(w,h); 
InBlock.gifpop.moveTo((screen.width
-w)/2,(screen.height-h)/2); 
InBlock.gifpop.document.writeln(contents); 
InBlock.gif
if(pop.document.body.clientWidth!=w||pop.document.body.clientHeight!=h) //如果无边视窗不是出现在纯粹的IE视窗中 
ExpandedSubBlockStart.gif

InBlock.giftemp
=window.open("","nbw_v6"); 
InBlock.giftemp.close(); 
InBlock.gifwindow.showModalDialog(
"about:<"+"script language=javascript>window.open('','nbw_v6','fullscreen=yes');window.close();"+"</"+"script>","","dialogWidth:0px;dialogHeight:0px"); 
InBlock.gifpop2
=window.open("","nbw_v6"); 
InBlock.gifpop2.resizeTo(w,h); 
InBlock.gifpop2.moveTo((screen.width
-w)/2,(screen.height-h)/2); 
InBlock.gifpop2.document.writeln(contents); 
InBlock.gifpop.close(); 
ExpandedSubBlockEnd.gif}
 
ExpandedBlockEnd.gif}
 
None.gif
</ script >  
None.gif//第二步:把如下代码加入
< body ></ body > 区域中 
None.gif
< href =#none  onclick =noBorderWin('rate.htm','400','240','#000000','#333333','#CCCCCC','一个无边视窗的测试例子','yes'); > open〈/a〉


本文转自高海东博客园博客,原文链接:http://www.cnblogs.com/ghd258/archive/2007/01/11/617933.html,如需转载请自行联系原作者
相关文章
使用Delphi开发IE按钮扩展
介绍除了可以向IE中添加自定义菜单外,我们还可以向IE的工具条上添加自定义的按钮。自定义按钮同自定义菜单COM扩展的实现几乎一样, 除了在注册时需要添加的注册表项不同。
675 0
|
6月前
|
Web App开发 前端开发 JavaScript
|
1月前
|
存储 机器人
在阿里云RPA中,你可以通过以下步骤来更改默认唤醒IE浏览器的地址
【2月更文挑战第28天】在阿里云RPA中,你可以通过以下步骤来更改默认唤醒IE浏览器的地址
19 1
|
7月前
|
Web App开发 XML 编解码
IE浏览器下载文件中文文件名乱码问题解决
IE浏览器下载文件中文文件名乱码问题解决
84 0
|
4月前
|
Web App开发 JavaScript 前端开发
JavaScript在IE和标准浏览器下的兼容性处理
JavaScript在IE和标准浏览器下的兼容性处理
41 0
|
5月前
|
前端开发
border-radius 兼容 IE8浏览器
border-radius 兼容 IE8浏览器
40 1
|
5月前
|
Web App开发 移动开发 安全
IE浏览器,和Edge浏览器
IE浏览器,和Edge浏览器