Calculation not working in Firefox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MikeMiller
    New Member
    • Oct 2011
    • 1

    Calculation not working in Firefox

    I am trying to create a simple calculation script to result in how many boxes of tiles are required for certain square metre coverage.

    You enter 2.5 square metres - click calculation and then you get you will need x amount of boxes with 7 tiles spare. All works perfectly in all browsers except Firefox I get the error in the firebug console "wallarea not defined" (I do not understand this) I am not a coder I am trying to learn so if you can help please be as detailed as you can and help explain why this is an issue. Thanks :D

    The code:
    Code:
    				<p>To calculate how many boxes of these tiles you can use our handy calculator</p>
    				<p>
    					I need to cover<input type="text" id="wallarea" size="6" /> square metres.
    					<input type="button" onclick="calcTiles(<?php echo $product_width ?>, <?php echo $product_height ?>, <?php echo $product_packaging_unitsinbox ?>, wallarea.value, 'total_boxes'); return false;" value="Calculate" class="addtocart_button" />
    				</p>
    				<p><span id="total_boxes"></span></p>
    		</div>
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    to access a form value via document.form_n ame.element_nam e.value you need to give the element a name attribute. only IE silently maps IDs and NAMEs to global variables.

    Comment

    Working...