in a html code like this --------------------------- Temperature Converter Temperature Converter Convert from Fahrenheit to Celsius Fahrenheit Enter Fahrenheit temperature...


 in a html code like this


---------------------------







Temperature Converter






Temperature Converter





Convert from Fahrenheit to Celsius











Enter Fahrenheit temperature























































































------


1.js


var arr1 = [];


function validate(evt) {


var theEvent = evt || window.event;


if (theEvent.type === 'paste')


{


key = event.clipboardData.getData('text/plain');


}


else {


var key = theEvent.keyCode || theEvent.which;


key = String.fromCharCode(key);


console.log(evt.target.value);


}


var regex = /^[+-]?[0-9.]{1,9}(?:\.[0-9]{1,2})?$/


if(theEvent.keyCode==45 && evt.target.value=="")


{return true;}


else{


if( !regex.test(key) )


{


theEvent.returnValue = false;


if(theEvent.preventDefault) theEvent.preventDefault();


}


}


}




function convertToC() {


let fValue = document.getElementById("fInputValue").value;


if(-9999<=fvalue &&=""><>


{


let cTemp = ((fValue - 32) / 1.8).toFixed(2);


document.getElementById("resultCValue").innerHTML = `= ${cTemp} C`;


document.getElementById("resultCValue").style.color='white';


loadArrayData(cTemp, fValue);


}


else{


document.getElementById("resultCValue").innerHTML = "Value should be between -9999 to 9999";


document.getElementById("resultCValue").style.color='red';


}


}


function loadArrayData(data, anotherData)


{


var oldValue = document.getElementById("dataHistory").innerHTML;


if((data != '' || data != null) && (anotherData != '' || anotherData != null))


{


arr1.push({


Celsius:data,


Fahrenheit:anotherData


});


}


for(i=0;i<>


{


document.getElementById("dataHistory").innerHTML = oldValue+"
"+arr1[i].Fahrenheit+ "                  " +arr1[i].Celsius+"\t";


}


document.getElementById("resultLine").innerHTML = "\t=============\n"


}


function calcAverage() {


const avgCel = (arr1.reduce((t,b) => {


return t + +b.Celsius


}, 0) / arr1.length).toFixed(2);


const avgFahr = (arr1.reduce((t,b) => {


return t + +b.Fahrenheit


}, 0) / arr1.length).toFixed(2);


var oldValue = document.getElementById("totalAverage").innerHTML;


document.getElementById("totalAverage").innerHTML = avgFahr+"             "+avgCel ;


}


function clearHistory()


{


arr1 = [];


document.getElementById("resultData").innerHTML = '';


document.getElementById("fInputValue").value = '';


document.getElementById("resultCValue").innerHTML = '';


}


-------------------


how could i  make the submit ,average and  reset button all disable until i enter a number between -9999 to 9999 ?

Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here