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


/*This script will input three strings and output one as an integer, one as
a float, and the thrid as a string.*/

var string1 = null;//declaring and setting a string to the null string.
var numstring = null;
var num1 =0, num2=0.0;// setting an integer and float to zero.

numstring = prompt ("Please enter an Integer","");//inputting a string.
numstring2=prompt("Please enter a float", "");
string1 = prompt("Please enter a string", "");

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

//outputing the numbers below
alert("Your integer is : " + num1 + "\nYour float is : " + num2 + "\nYour string is : " + string1);

Run the script
Output to inputdata.htm