The forum was getting rather boring lately, so I thought I'd post some interesting JavaScripts that take advantage of Activ's IE components: the Zoom In and Zoom Out functions available in I.E. 5.5 +.The Zoom function works in ebooks and htmlhelp files (help files with the .chm extension) just as well as web pages. Animations, links and embedded objects, such as Java applets, still work at any zoomed resolution. Print the page, and it prints in the zoomed resolution.
Here are the JavaScript functions, followed by the button markup that calls the Zoom() functions.
<script language="JavaScript" type="text/javascript">
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// © Copperfield Publishing (www.copperfieldpub.com)
// This copyright notice must stay intact if using this script
// Zoom in & Zoom out
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function zoomin(){
if(parent.parent.document.body.style.zoom!=0)
parent.parent.document.body.style.zoom*=1.2;
else
parent.parent.document.body.style.zoom=1.2;
}
function zoomout(){
if(parent.parent.document.body.style.zoom!=0)
parent.parent.document.body.style.zoom*=0.833;
else
parent.parent.document.body.style.zoom=0.833;
}
function zoomrest(){
if(parent.parent.document.body.style.zoom!=0)
parent.parent.document.body.style.zoom*=0;
else
parent.parent.document.body.style.zoom=0;
}
</script>
Here is the code to create buttons that evoke the three zoom functions:
<input type="button" value="Zoom +" ONCLICK="zoomin();">
<input type="button" value="Zoom -" ONCLICK="zoomout();">
<input type="button" class="butzoom" value="Restore" ONCLICK="zoomrest();">
You can evoke the function now, just by entering this into your IE address bar, and hitting <Enter>.
Refresh will return your page to normal:
--------copy and paste this into your address bar:
javascript: (function(){ function zoomout(){if(window.parent.document.body.style.zoom!=0) window.parent.document.body.style.zoom*=0.8; else window.parent.document.body.style.zoom=0.8;}zoomout();})();
-------end copy and paste
Further, you can create buttons in your IE browser with the ZOOM commands, ready to use on any page you visit.
Details on adding it to your browser links toolbar are posted here:
http://www.copperfieldpub.com////main.htm?toolsbrowser_button_scripts
best -
roger nilsson
Copperfield Publishing
Team MacroMedia
eHelp MVP
(Edited by Alaska at 11:46 pm on Aug. 27, 2004)