Firefox和Opera放大使用javascript缩小 [英] Firefox and Opera Zoom In Zoom Out using javascript

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

问题描述

你好我想实现放大/缩小功能,这是可用的铬和IE浏览器/ b>

例如在IE中,我可以很容易地设置缩放,百分比通过使用下面的JavaScript代码

 
document.style.zoom =20%;

如何在Firefox和Opera中实现相同的功能,对于Firefox 3以后版本的atleast,据我所知:

 <$ c $>解决方案

c> Components.classes [@ mozilla.org/appshell/window-mediator;1\"].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow(\"navigator:browser\").getBrowser().mCurrentBrowser.markupDocumentViewer.fullZoom = 3;

通过从Firefox的工具菜单中选择错误控制台来启动Javascript控制台。然后,在代码文本框中键入以下内容,然后单击评估按钮。对于3倍变焦你可以改变数字在最后测试

因此,如果浏览器是FF我想你可以做到这一点,但肯定。很可能您需要签名的脚本 http://www.mozilla.org/ projects / security / components / signed-scripts.html

Hi I want to achieve zoom in/out feature which is available in chrome and IE

For instance in IE I can easily set the zoom, percentage by using the following javascript code

document.style.zoom="20%";

How can I achieve the same in Firefox and Opera, any help,guideline is really appreciated.

解决方案

for firefox after version 3 atleast as far as i know :

Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator).getMostRecentWindow("navigator:browser").getBrowser().mCurrentBrowser.markupDocumentViewer.fullZoom = 3;

Launch the Javascript console by selecting Error Console from Firefox's Tools menu. Then, type the following into the code text box and click the Evaluate button. for 3x zoom u can change the number at the end for testing

So if the browser is FF i guess you can do this aint that sure though. Most probably you will need signed scripts http://www.mozilla.org/projects/security/components/signed-scripts.html

这篇关于Firefox和Opera放大使用javascript缩小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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