Link to home
Start Free TrialLog in
Avatar of LittleOleMeDesigns
LittleOleMeDesigns

asked on

ZenCart and javascript form calcuations not working?

I have a little calculation routine in javascript that works with a form on a page in ZenCart.. I can't seem to get it to work.  Does anyone have any ideas?

The page can be viewed here:
http://gaultav.com/ZenCart/index.php?main_page=page&id=4

Here's the code for this part of the page:
<script type="text/javascript">
function calcDistance()
{
var height = document.distance.height.value
var distance = height * 8
document.distance.answer.value = Math.round(distance/12*100)/100
}
</script>
<table cellspacing="5" cellpadding="5" background="tableback.jpg" align="center" width="80%" style="">
    <tbody>
        <tr>
            <th align="center" colspan="2"><span style="font-size: large;"><span style="font-family: Times New Roman;">MONITOR VIEWING DISTANCE CALCULATOR</span></span></th>
        </tr>
        <tr>
            <td align="center" colspan="2"><span style="font-size: large;"><span style="font-family: Times New Roman;">Enter the monitor <u>display height</u> in inches, then press the CALCULATE button:</span></span></td>
        </tr>
        <tr>
            <form name="distance">
                <span style="font-size: large;"><span style="font-family: Times New Roman;">                 &nbsp;             </span></span>
            </form>
            <td align="right"><span style="font-size: large;"><span style="font-family: Times New Roman;"><input type="text" name="height" size="6" style="" /></span></span></td>
            <td align="left"><span style="font-size: large;"><span style="font-family: Times New Roman;"><input type="button" class="btn" onmouseover="this.className='btnon'" onmouseout="this.className='btn'" value="Calculate" onclick="javascript:calcDistance();" />&nbsp;</span></span></td>
        </tr>
        <tr>
            <td align="right"><span style="font-size: large;"><span style="font-family: Times New Roman;">Maximum Viewing Distance:</span></span></td>
            <td align="left"><span style="font-size: large;"><span style="font-family: Times New Roman;"><input type="text" name="answer" size="6" />&nbsp;&nbsp;FEET</span></span></td>
        </tr>
    </tbody>
</table>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Kin Fat SZE
Kin Fat SZE
Flag of Hong Kong image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LittleOleMeDesigns
LittleOleMeDesigns

ASKER

AWESOME!!  I had a feeling it was going to be something simple.. I just couldn't figure it out.  Thank-You!!