为了提升上网体验,现在很多弹出窗口都被IE插件屏蔽掉了,有些朋友就急了,本来弹出一个窗口是想警示的,并不是什么广告,但也被屏掉了,下面介绍一种用JS控制弹出一个IE无法屏蔽的无边框窗口的方法,虽说不是很理想,但大多数情况下都有效,IE没有办法屏蔽的。
  | | <title>IE无法屏蔽的无边框窗口</title> |
  | | <script language=javascript> |
  | | minimizebar="images/"; //最小化“按钮”的图片 |
  | | closebar="images/"; //关闭“按钮”的图片 |
  | | icon="images/"; //左上角图标 |
  | | function noBorderWin(fileName,w,h,titleBg,titleColor,titleWord,borderColor,scr) |
  | | { |
  | | nbw=window.open('','','fullscreen=yes'); |
  | | nbw.resizeTo(w,h); |
  | | nbw.moveTo((screen.width-w)/2,(screen.height-h)/2); |
  | | nbw.document.writeln("<title>"+titleWord+"</title>"); |
  | | nbw.document.writeln("<"+"script language=javascript"+">"+"cv=0"+"<"+"/script"+">"); |
  | | nbw.document.writeln("<body topmargin=0 leftmargin=0 scroll=no>"); |
  | | nbw.document.writeln("<table cellpadding=0 cellspacing=0 width=300 height=100% style=\"border: 1px solid "+borderColor+"\">"); |
  | | nbw.document.writeln(" <tr bgcolor="+titleBg+" height=20 onselectstart='return false' onmousedown='cv=1;x=event.x;y=event.y;setCapture();' onmouseup='cv=0;releaseCapture();' onmousemove='if(cv)window.moveTo(screenLeft+event.x-x,screenTop+event.y-y);'>"); |
  | | nbw.document.writeln(" <td width=21 align=left><img width=12 width=12 src="+icon+"></td>"); |
  | | nbw.document.writeln(" <td style=\"font-size:12px; color:"+titleColor+";\"><span style='top:1;position:relative;cursor<img src="/editor/images/smilies/default/22.gif" />efault;'>"+titleWord+"</span></td>"); |
  | | nbw.document.writeln(" <td align=right width=30 style=font-size:16px>"); |
  | | nbw.document.writeln(" <img border=0 width=12 height=12 alt=最小化 src="+minimizebar+" onclick=window.blur();>"); |
  | | nbw.document.writeln(" <img border=0 width=12 height=12 alt=关闭 src="+closebar+" onclick=window.close();>"); |
  | | nbw.document.writeln(" </td>"); |
  | | nbw.document.writeln(" </tr>"); |
  | | nbw.document.writeln(" <tr>"); |
  | | nbw.document.writeln(" <td colspan=3><iframe frameborder=0 width=100% height=100% scrolling="+scr+" src="+fileName+"></iframe></td>"); |
  | | nbw.document.writeln(" </tr>"); |
  | | nbw.document.writeln("</table>"); |
  | | } |
  | | </script> |
  | | <button onclick=noBorderWin('/','298','232','#333333','#eeeeee','无边窗口例子','#000000','no');>打开窗口</button> |
  | | |
  | | <a href="http://www.webdm.cn">网页代码站</a> - 最专业的代码下载网站 - 致力为中国站长提供有质量的代码! |