I found the problem. I needed to declare the variables within the functions.


I have a page with an embedded autocad dwf file, and a form with buttons to zoom in and zoom out. I've used the following script with the onClick event:

<SCRIPT LANGUAGE="JavaScript">
<!--hide code from old browsers

var bottom = eval(drawing.GetCurrentViewBottom ());
var left = eval(drawing.GetCurrentViewLeft ());
var right = eval(drawing.GetCurrentViewRight ());
var top = eval(drawing.GetCurrentViewTop ());

var currentwidth = eval(right - left);
var currentheight = eval(top - bottom);
var newwidth;
var newheight;

function zoomin()
{
newwidth = eval(currentwidth*0.8);
newheight = eval(currentheight*0.8);
left = left + eval((currentwidth-newwidth)/2);
right = left + newwidth;
bottom = bottom + eval((currentheight-newheight)/2);
top = bottom + newheight;
currentwidth = newwidth;
currentheight = newheight;

drawing.DrawView (left, right, bottom, top)
}

function zoomout()
{
newwidth = eval(currentwidth*1.25);
newheight = eval(currentheight*1.25);
left = left - eval((newwidth-currentwidth)/2);
right = left + newwidth;
bottom = bottom - eval((newheight-currentheight)/2);
top = bottom + newheight;
currentwidth = newwidth;
currentheight = newheight;

drawing.DrawView (left, right, bottom, top)
}

//end hiding-->
</SCRIPT>

When I click the zoom in or out buttons the drawing zooms to it's extents. What am I doing wrong?

[This message has been edited by christine (edited 06-01-99).]