
More JavaScript Equivalents
Acceleration | Area Equivalents | Ascii Engine | Base Converter | Degrees Radians | Energy Equivalents | Euro Converter | Hertz Converter | Hex Rgb Converter | Japanese Pronunciation | Kilobytes To Megabytes | Length Equivalents | Mass Equivalents | Metrology Equivalents | Morse Code | Phone Num Converter | Power Equivalents | Pressure Equivalents | Rgb To Hex | Fahrenheit to Celsius | Celsius Fahrenheit | Time Converter | Url Revealer | Velocity Equivalents | Number To English
Description
Javascript allows for the conversion back and forth from hours, minutes, and seconds to fractional hours. Input validation also ensures the time input does not contain invalid characters. Definitely a time-saver for time-related record keeping....View A Script Demo
Javascript allows for the conversion back and forth from hours, minutes, and seconds to fractional hours. Input validation also ensures the time input does not contain invalid characters. Definitely a time-saver for time-related record keeping....View A Script Demo
Do you find it confusing setting up these script?
Java Scripts Magic can do all the hard work for you all At The Touch Of A Button.
Java Scripts Magic can do all the hard work for you all At The Touch Of A Button.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="TextPad 4.4">
<LINK href="general.css" rel="stylesheet" type="text/css">
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Ryan Sokol -->
<!-- Begin
function checkInt(str) {
if (!str) return 0;
var ok = "";
for (var i = 0; i < str.length; i++) {
var ch = str.substring(i, i+1);
if (ch < "0" || "9" < ch) {
alert("Only integer input is allowed!\n\n"
+ parseInt(ok) + " will be used because '"
+ str + "' is invalid.\nYou may correct "
+ "this entry and try again.");
return parseInt(ok);
}
else ok += ch;
}
return parseInt(str);
}
function checkDecimal(str) {
if (!str) return 0;
var ok = "";
for (var i = 0; i < str.length; i++) {
var ch = str.substring(i, i+1);
if ((ch < "0" || "9" < ch) && ch != '.') {
alert("Only numeric input is allowed!\n\n"
+ parseFloat(ok) + " will be used because '"
+ str + "' is invalid.\nYou may correct "
+ "this entry and try again.");
return parseFloat(ok);
}
else ok += ch;
}
return str;
}
function makeHours(form) {
hour = (checkInt(form.hour.value)); // validates input
min = (checkInt(form.min.value)); // sets invalid input to 0
sec = (checkInt(form.sec.value));
return (hour + min/60 + sec/3600);
}
function makeTime(form) {
num = (checkDecimal(form.hourtotal.value)); // validates input
if (num) {
form.hour.value = parseInt(num);
num -= parseInt(num); num *= 60;
form.min.value = parseInt(num);
num -= parseInt(num); num *= 60;
form.sec.value = parseInt(num);
}
}
// End -->
</script>
</HEAD>
<BODY Background=../graphics/grayback.jpg>
<center><BR><BR><BR>
<form name="timeconverter">
<table border=1>
<tr>
<td>Time:</td>
<td>
<input type=text name=hour size=3 maxlength=3> Hours<br>
<input type=text name=min size=3 maxlength=3> Minutes<br>
<input type=text name=sec size=3 maxlength=3> Seconds
</td>
</tr>
<tr>
<td>Hours:</td>
<td>
<input type=text name=hourtotal size=10>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<input type=button nametoHours value="Time to Hours" onClick="this.form.hourtotal.value=makeHours(this.form);">
<br>
<input type=button name=toTime value="Hours to Time" onClick="makeTime(this.form);">
</td>
</tr>
</table>
</form>
</center>
</BODY>
</HTML>
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="TextPad 4.4">
<LINK href="general.css" rel="stylesheet" type="text/css">
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Ryan Sokol -->
<!-- Begin
function checkInt(str) {
if (!str) return 0;
var ok = "";
for (var i = 0; i < str.length; i++) {
var ch = str.substring(i, i+1);
if (ch < "0" || "9" < ch) {
alert("Only integer input is allowed!\n\n"
+ parseInt(ok) + " will be used because '"
+ str + "' is invalid.\nYou may correct "
+ "this entry and try again.");
return parseInt(ok);
}
else ok += ch;
}
return parseInt(str);
}
function checkDecimal(str) {
if (!str) return 0;
var ok = "";
for (var i = 0; i < str.length; i++) {
var ch = str.substring(i, i+1);
if ((ch < "0" || "9" < ch) && ch != '.') {
alert("Only numeric input is allowed!\n\n"
+ parseFloat(ok) + " will be used because '"
+ str + "' is invalid.\nYou may correct "
+ "this entry and try again.");
return parseFloat(ok);
}
else ok += ch;
}
return str;
}
function makeHours(form) {
hour = (checkInt(form.hour.value)); // validates input
min = (checkInt(form.min.value)); // sets invalid input to 0
sec = (checkInt(form.sec.value));
return (hour + min/60 + sec/3600);
}
function makeTime(form) {
num = (checkDecimal(form.hourtotal.value)); // validates input
if (num) {
form.hour.value = parseInt(num);
num -= parseInt(num); num *= 60;
form.min.value = parseInt(num);
num -= parseInt(num); num *= 60;
form.sec.value = parseInt(num);
}
}
// End -->
</script>
</HEAD>
<BODY Background=../graphics/grayback.jpg>
<center><BR><BR><BR>
<form name="timeconverter">
<table border=1>
<tr>
<td>Time:</td>
<td>
<input type=text name=hour size=3 maxlength=3> Hours<br>
<input type=text name=min size=3 maxlength=3> Minutes<br>
<input type=text name=sec size=3 maxlength=3> Seconds
</td>
</tr>
<tr>
<td>Hours:</td>
<td>
<input type=text name=hourtotal size=10>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<input type=button nametoHours value="Time to Hours" onClick="this.form.hourtotal.value=makeHours(this.form);">
<br>
<input type=button name=toTime value="Hours to Time" onClick="makeTime(this.form);">
</td>
</tr>
</table>
</form>
</center>
</BODY>
</HTML>
If you have a Business Proposal that you think may be of interest to us here at Best Download Sites please contact us to discuss the matter in further detail

