This procedure is the simplest, but it is not friendly enough and rigorous enough. I'll help you change it. You can save the following code as. Html file and open it with ie.
& lthtml & gt
& lthead & gt
& lttitle & gt& lt/title & gt;
& lt scripting language = "javascript">
Function speed () {
var distance = document . getelementbyid(' id instance ');
var time CNT = document . getelementbyid(' itime CNT ');
if (isNaN(distance.value)) {
Alert ('Length must be numeric!' );
distance . focus();
Return;
}
if (isNaN(timecnt.value)) {
Alert ('Time must be a number!' );
time CNT . focus();
Return;
}
if (timecnt.value == 0) {
Alert ('Time cannot be 0!' );
time CNT . focus();
Return;
}
document . getelementbyid(' s value ')。 innerText = distance . value/time CNT . value;
}
& lt/script & gt;
& lt/head & gt;
& ltbody & gt
length < input type = ' text ' name = ' I instance ' id = ' I instance ' value = ' '/& gt; & ltbr/>;
time
& ltinput type = ' button ' value = ' calculation ' onclick = ' velocity()'/& gt; & ltbr/>; & ltbr/>;
Calculation result:
& lt/body & gt;
& lt/html & gt;