JavaScript - convert label value into integer in javascript function

Asked By Nitish Gupta on 13-Sep-12 07:10 AM
hello,
 i want to convert label value into integer  inside javascript function and store it in variable also.
and i also want to know the way to pass integer value to javascript function.
Rolf Jaeger replied to Nitish Gupta on 13-Sep-12 08:21 AM
Hi Nitish:

here is a code example.

Hope this helped,
Rolf

var s = "77";
var i = parseInt(s, 10);
printTest(i);
function printTest(k)
{
  alert(k);
}
Jitendra Faye replied to Nitish Gupta on 14-Sep-12 12:11 AM
First thing is that the value  which you want to convert to integer that shoulde be able to convert to integer type otherwise you will get error.

try like this-

var intdata=  parseInt(document.getElementById("LabelName").value);