The entire program runs except for the validation.
Can you please fix this for me?
I am seeing cross-eyed and have to get ready for school and haven't been to bed all night.
function validator()
var MINNUM = (<1)
var MAXNUM = (>1000000)
//Validate the inputted meters
while((isNaN(meters)) || (meters < MINNUM) || (meters > MAXNUM))
{
alert("Invalid digit entered. Must be between 1 & 1000000.");
return result;
};
var report = function(meters,kilometers)
{
document.getElementById("result").innerHTML = //"result" gets sent to the HTML page where it is being asked for
meters + " meters are equal to " + kilometers + " kilometers";
//is just the text that will show up on the monitor. meters + is what the user typed in. The space after the quotations will insert what was typed in by the user then the text shows up (meters are equal to). + kilometers + inserts the caculation below. The space after the quotations will insert what was caculated. Then the text shows up (kilometers).
};
document.getElementById("m_to_k").onclick = function() // after the user types in the digits the user will click on the button of choice which will preform the caculation below.
{
var meters = document.getElementById("distance").value; //meters will be equal to what the user typed in and be sent to report
var kilometers = (meters *.001); //kilometers will be equal to the caculation in parenthises and will send it to report
report(meters, kilometers); //this report has the information of the digits that were entered (meters) plus the caculation (kilometers) that will be grabbed by the HTL page to be displayed.
};
var report2 = function(meters,inches)
{
document.getElementById("result").innerHTML =
meters + " meters are equal to " + inches + " inches";
};
document.getElementById("m_to_i").onclick = function()
{
var meters = document.getElementById("distance").value;
var inches = (meters * 39.37);
report2(meters, inches);
};
var report3 = function(meters,feet)
{
document.getElementById("result").innerHTML =
meters + " meters are equal to " + feet + " feet";
};
document.getElementById("m_to_f").onclick = function()
{
var meters = document.getElementById("distance").value;
var feet = (meters * 3.281);
report3(meters, feet);
};