<HTML>

<HEAD>
<TITLE>Java Script input string and convert to integer and float</A></TITLE>
</HEAD>

<BODY>

<SCRIPT>
/*This script will input a float and then add the numbers*/

var numstring1 = null, numstring2 = null; //declearing and intializing strings to null
var num1 =0.0, num2=0.0, sum = 0.0;// declaring and intializing floats (reals) to zero.

numstring1 = prompt ("Please enter an float","");//inputting a real number
numstring2 = prompt ("Please enter an float","");//inputting a real number

num1 = parseFloat(numstring1);//converting the first string to an integer.
num2 = parseFloat(numstring2);// converting the second string to a float.

sum = num1 + num2; // adding the numbers.

//outputing the numbers below
alert("****\n" +num1+ " + " +num2+ " = " +sum+ "\n####");

</SCRIPT>
</BODY>
</HTML>
Run Script
Sample Output