93 lines
2.1 KiB
HTML
93 lines
2.1 KiB
HTML
<html>
|
|
<head>
|
|
<title>Time Chooser</title>
|
|
<script>
|
|
function populateField() {
|
|
var hours = document.timeForm.hour24.selectedIndex;
|
|
if (hours<10) hours = "0"+hours;
|
|
var minutes = document.timeForm.minute.selectedIndex;
|
|
if (minutes<10) minutes = "0"+minutes;
|
|
var seconds = document.timeForm.second.selectedIndex;
|
|
if (seconds<10) seconds = "0"+seconds;
|
|
var timevalue = hours+":"+minutes+":"+seconds;
|
|
timeField.value = timevalue;
|
|
timeField.focus()
|
|
window.close();
|
|
}
|
|
function setDefault() {
|
|
this.timeField = opener.timeField;
|
|
var inTime = timeField.value;
|
|
var inHour = inTime.substring(0,inTime.indexOf(":"));
|
|
var inMinute = inTime.substring(inTime.indexOf(":") + 1, inTime.lastIndexOf(":"));
|
|
var inSecond = inTime.substring(inTime.lastIndexOf(":") + 1, inTime.length);
|
|
document.timeForm.hour24.selectedIndex = inHour;
|
|
document.timeForm.minute.selectedIndex = inMinute;
|
|
document.timeForm.second.selectedIndex = inSecond;
|
|
}
|
|
function setNow() {
|
|
var Digital = new Date();
|
|
document.timeForm.hour24.selectedIndex = Digital.getHours();
|
|
document.timeForm.minute.selectedIndex = Digital.getMinutes();
|
|
document.timeForm.second.selectedIndex = Digital.getSeconds();
|
|
}
|
|
function setZero() {
|
|
document.timeForm.hour24.selectedIndex = "00";
|
|
document.timeForm.minute.selectedIndex = "00";
|
|
document.timeForm.second.selectedIndex = "00";
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onLoad="setDefault()">
|
|
|
|
<form name="timeForm">
|
|
|
|
<select name="hour24">
|
|
<script>
|
|
for (var i=0;i<24;i++) {
|
|
var j = i;
|
|
if (j<10) j = "0"+j;
|
|
document.write('<option value="'+j+'">'+j+'</option>');
|
|
}
|
|
</script>
|
|
</select>
|
|
|
|
:
|
|
|
|
<select name="minute">
|
|
<script>
|
|
for (var i=0;i<60;i++) {
|
|
var j = i;
|
|
if (j<10) j = "0"+j;
|
|
document.write('<option value="'+j+'">'+j+'</option>');
|
|
}
|
|
</script>
|
|
</select>
|
|
|
|
:
|
|
|
|
<select name="second">
|
|
<script>
|
|
for (var i=0;i<60;i++) {
|
|
var j = i;
|
|
if (j<10) j = "0"+j;
|
|
document.write('<option value="'+j+'">'+j+'</option>');
|
|
}
|
|
</script>
|
|
</select>
|
|
|
|
<input value="set" type="button" onClick="populateField()" />
|
|
<p>
|
|
|
|
<!--input value="Set to Now" type="button" onClick="setNow()" -->
|
|
<input value="Set to Zero" type="button" onClick="setZero()" />
|
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|
|
|
|
|
|
|