javascript和IE 8的问题 [英] javascript and IE 8 problem

查看:63
本文介绍了javascript和IE 8的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< html>

 < head>

  <标题>新文件< / title>

  < meta name =" Generator" content =" EditPlus">

  < meta name =" Author" content ="">

  < meta name ="关键字" content ="">

  < meta name =" Description" content ="">

  < script type =" text / javascript" language =" javascript">

  function openpopup(){

  w = window.open('','','width = 300,height = 300');

  }¥b $ b  function checkFocus(){

  if(false == w.closed){

 提示("弹出窗口已打开");

  w.focus();

  }¥b $ b  }¥b $ b  < / script>

 < / head>



 < body onload =" openpopup(); window .print(); checkFocus();">

  < input type =" button"名称= QUOT; B" value =" open" />

 < / body>

< / html>

¥ b $ bi有上面的代码。当我在IE8中运行时,即使我使用w.focus(),焦点也会出现在打印对话框中。是否有任何解决方案?

widow.focus() 什么都没有...

<html>
 <head>
  <title> New Document </title>
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <script type="text/javascript" language="javascript">
  function openpopup() {
  w=window.open('','','width=300,height=300');
  }
  function checkFocus() {
  if(false == w.closed) {
  alert("pop up window is open");
  w.focus();
  }
  }
  </script>
 </head>

 <body onload="openpopup();window.print();checkFocus();">
  <input type="button" name="b" value="open"/>
 </body>
</html>

i have the above code.when i run this in IE8 the focus is coming to print dialog even i use w.focus() .Is there any solution ?
widow.focus()  nothing working...

以上代码适用于IE 9.重点关注弹出窗口。而不是打印窗口。

the above code works in IE 9.its focussing on popup. instead of print window.

谢谢..

推荐答案

w的范围仅在调用函数内。 window是一个全局对象。

the scope of w is only within the calling function. window is a global object.

viz ... window.print()和w.print()是两回事....

viz... window.print() and w.print() are two different things....

用户可以使用文件>打印菜单或命令栏按钮打印网页。网上有很多例子显示如何在网页上添加打印页面按钮...

users can print a web page with the File>Print menu or Command bar button. There are plenty of examples on the web showing how to add a Print page button to your web page...

问候。


这篇关于javascript和IE 8的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆