2014-08-29 104 views
0

我有下面的代码启动页面并将缩放设置为175%。我想这样做的w3schools链接在下面...例如。在任何人都知道如何的儿童窗口中。谢谢 。在新的Internet Explorer子窗口上设置缩放级别

IE 8兼容,目前不关心其他浏览器。

<html> 
    <head> 
    <title>olecmdid</title> 
<script> 
    function zoom(percent) { 
     var PROMPT = 1; // 1 PROMPT & 2 DONT PROMPT USER 
     var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>'; 
     document.body.insertAdjacentHTML('beforeEnd', WebBrowser); 
     var status = WebBrowser1.QueryStatusWB(63); 
     document.getElementById("QueryStatusWB_Result").innerHTML = status; 
     WebBrowser1.ExecWB(63,PROMPT,percent,null); 
     WebBrowser1.outerHTML = ""; 
    } 
    </script> 
    </head> 
    <body onload="zoom(175);"> 
    <form name="form"> 
    <input type="Button" value="25%" onclick="zoom(25);"> 
    <input type="Button" value="50%" onclick="zoom(50);"> 
    <input type="Button" value="100%" onclick="zoom(100);"> 
    <input type="Button" value="150%" onclick="zoom(150);"> 
    <input type="Button" value="200%" onclick="zoom(200);"> 
    </form> 
    <a href="http://www.w3schools.com" target="_blank">Visit W3Schools.com!</a> 
    </body> 
    </html> 

回答

0

我成功地为我所需要的解决方案。所以我调整了现有窗口的大小,然后启动一个新窗口,然后返回并调整原始窗口的大小。可能帮助别人。

<html> 
<head> 
<meta http-equiv="x-ua-compatible" content="IE=10"> 


<script> 


function openwind() { 


zoom(400); 
var purchaseWin = window.open("test.html", "Google", "width=600, height=600"); 


setTimeout(function(){ 
zoom(100); 
}, 500); 
} 


function zoom(percent) { 
document.getElementById('WebBrowser1').ExecWB(63,2,percent,null); 
} 


</script> 


</head> 
<body> 


<input type="button" value="Open window 400% Zoomed" onclick="openwind()"> 


<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT> 


</body> 
</html>