Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Document Zoom In and Zoom Out questions

Status
Not open for further replies.

royyan

Programmer
Jul 18, 2001
148
US
I have two frames. I would like to have "Zoom In" and "Zoom Out" links in Frame1. Once I click Zoom links, the document in Frame2 will be zoomed in or out.
Any good suggestions?
Thanks!
 

Well, for Internet Explorer you can use style.zoom:

Code:
<script type="text/javascript">

function zoom() {

	if( document.body.style.zoom != 0 )
		document.body.style.zoom *= 2;
	else
		document.body.style.zoom = 2;
}

</script>

<a onclick="zoom();">zoom in</a>

Play with that and see how you get on.
 
Thanks for the reply.
The code you rprovided works fine in one frame situation.
My current issue is the zoom command can't pass to the Frame2.
Any suggestions?
Thanks!
 

This works for me:

frameset.html:
Code:
<html>
<frameset cols="50%,50%">
	<frame src="frame1.html" name="Frame1"></frame>
	<frame src="frame2.html" name="Frame2"></frame>
</frameset>
</html>

frame1.html:
Code:
<html>
<head>
	<script type="text/javascript">
	<!--
		function zoom(whatToZoom) {
			if (whatToZoom.style.zoom != 0) {
				whatToZoom.style.zoom *= 2;
			} else {
				whatToZoom.style.zoom = 2;
			}
		}
	//-->
	</script>
</head>
<body>
	<h1>Frame 1</h1>
	Click <a href="javascript:zoom(document.getElementsByTagName('body')[0]);">here</a> to zoom this frame
	<br />
	Click <a href="javascript:zoom(window.parent.frames['Frame2'].document.getElementsByTagName('body')[0]);">here</a> to zoom Frame 2
</body>
</html>

frame2.html:
Code:
<html>
<head></head>
<body>
	<h1>Frame 2</h1>
</body>
</html>

Basically, you pass a parameter into the zoom function, which is the pbject you wish to zoom.

Hope this helps,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top