troubleshooting Question

Javascript function/switch case issue

Avatar of MadIce
MadIce asked on
JavaScriptHTML
14 Comments1 Solution379 ViewsLast Modified:
Can someone explain what is wrong with the code below?  If I take out the SelectChange function, the zoom in and out functions work as wanted.  Can't get the dropdown to work with the SelectChange function.  get an "expecting a }" error on the line switch(optValue)


<!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
<html><head>
<meta http-equiv=content-type content="text/html; charset=utf-8">
<title>WorkingZoom</title>

<script>function zoom_in()
{
var z = document.images.zoom
z.height= parseInt(z.height*2)
z.width= parseInt(z.width*2)

}
function zoom_out()
{
var z = document.images.zoom
z.height= parseInt(z.height/2)
z.width= parseInt(z.width/2)
}

function SelectChange(optValue)
{
      var ThisWidth = "467";
      var ThisHeight = "350";
      var z = document.images.zoom

      switch(optValue)
      {
      Case 1:

      z.Width= parseInt(ThisWidth*1)
      z.Height= parseInt(ThisHeight*1)
      break;
      
      Case 2:
      z.Width= parseInt(ThisWidth*1.25)
      z.Height= parseInt(ThisHeight*1.25)
      break;

      Case 3:
      z.Width= parseInt(ThisWidth*1.5)
      z.Height= parseInt(ThisHeight*1.5)
      break;
      
      }
}
</script>

</head>
<body style="margin: 0;">
<form name=mySelect enctype="application/x-www-form-urlencoded">
<implicit_p><input type=button value="zoom in" onClick="zoom_in()"><input
 type=button value="zoom out" onclick="zoom_out()">
<select onChange="SelectChange(this.value)"
 name=cmbSelect size=1>
<option value=1>Normal</option>
<option VALUE=2>125%</option>
<option VALUE=3>150%</option>
<option VALUE=4>175%</option>
<option VALUE=5>200%</option>
<option VALUE=6>250%</option>
<option VALUE=7>300%</option>
<option VALUE=8>400%</option>
</select>
</form>
<div>
<implicit_p><img name=zoom src="image1.jpg"
 width=467 height=350 border=0>
</div>
</body>
</html>


FYI, I am not a javascript programmer.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 14 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros