1

My Javascript File

function getValues_sft_r(val){ var numVal1=parseFloat(document.getElementById("sft_i").value); var numVal2=(numVal1 / 5476); document.getElementById("sft_r").value = math.floor(numVal2) } 

My HTML File Test Page

<script type="text/javascript" src="java.js"></script> <style> input.numbox{ width:30px; height:20px; } input.mainbox{ width:30px; height:20px; font-size:30; font-weight:bold; } </style> Convert SQ.Ft. to Ropani : <br/> Sq.Ft.: <input class="numbox" type="text" id="sft_i" value="0" onkeyup="getValues_sft_r(1)" /> Ropani: <input style="mainbox" id="sft_r" value=""> </body> </html> 

I am not getting the Math.floor(numVal2) value in my HTML document. How should I do it to get the value?

3
  • 3
    Perhaps Math.round(..); instead of math.round(..)? Commented Sep 5, 2013 at 8:46
  • Math.Floor() does not appear even once in your code (and it would be incorrect if it did). Also, what do you mean by "I am not getting"...? Please edit your question so it is clear what you're asking. Commented Sep 5, 2013 at 8:46
  • 4
    I'm not seeing Math.Floor() in your code.... Commented Sep 5, 2013 at 8:47

2 Answers 2

1

Math.round() not math.round()

http://jsfiddle.net/hvty5/

function getValues_sft_r(val) { var numVal1 = parseFloat(document.getElementById("sft_i").value); var numVal2 = (numVal1 / 5476); document.getElementById("sft_r").value = Math.round(numVal2) } 
Sign up to request clarification or add additional context in comments.

1 Comment

Sorry for the last post. It was my mistake. It's actually math.floor(); which I've edited already.
1

Math has a capital letter and will therefore produce an error

Should be

Math.floor(); 

You might also want

class="mainbox" 

Not

style="mainbox" 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.