Date object problems
Posted: Sun Nov 21, 2010 4:50 pm
I'm Trying To Create Custom Date Object.
but am comeing back with a NaN error.
Source:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Alarm</title>
</head>
<style type="text/css">
</style>
<script type="text/javascript">
function startup() {
curdate = new Date();
h = curdate.getHours();
m = curdate.getMinutes();
s = curdate.getSeconds();
time = h + ":" + m + ":" + s;
AS_h = document.getElementById('input_hr').value;
AS_m = document.getElementById('input_mn').value;
AS_s = document.getElementById('input_sc').value;
AV_h = parseInt(AS_h);
AV_m = parseInt(AS_m);
AV_s = parseInt(AS_s);
alarmtime = AV_h + ":" + AV_m + ":" + AV_s;
document.getElementById('curtime').innerHTML=time;
setTimeout("startup()",1000);
document.getElementById('alarmtime_').innerHTML=alarmtime;
}
</script>
<body onLoad="startup()">
<span style="font-size:40px;">
Current Time:
</span>
<br />
<span style="font-size:40px;" id="curtime"></span>
<br />
<span id="alarmtime_"></span>
<hr />
<input type="text" class="" id="input_hr">
<input type="text" class="" id="input_mn">
<input type="text" class="" id="input_sc">
<br />
<input type="button" value="+1hr" onClick="">
<input type="button" value="+10min" onClick="">
<input type="button" value="+60sec" onClick="">
<input type="button" value="Start Alarm" onClick"alarmset()">
</body>
</html>
but am comeing back with a NaN error.
Source:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Alarm</title>
</head>
<style type="text/css">
</style>
<script type="text/javascript">
function startup() {
curdate = new Date();
h = curdate.getHours();
m = curdate.getMinutes();
s = curdate.getSeconds();
time = h + ":" + m + ":" + s;
AS_h = document.getElementById('input_hr').value;
AS_m = document.getElementById('input_mn').value;
AS_s = document.getElementById('input_sc').value;
AV_h = parseInt(AS_h);
AV_m = parseInt(AS_m);
AV_s = parseInt(AS_s);
alarmtime = AV_h + ":" + AV_m + ":" + AV_s;
document.getElementById('curtime').innerHTML=time;
setTimeout("startup()",1000);
document.getElementById('alarmtime_').innerHTML=alarmtime;
}
</script>
<body onLoad="startup()">
<span style="font-size:40px;">
Current Time:
</span>
<br />
<span style="font-size:40px;" id="curtime"></span>
<br />
<span id="alarmtime_"></span>
<hr />
<input type="text" class="" id="input_hr">
<input type="text" class="" id="input_mn">
<input type="text" class="" id="input_sc">
<br />
<input type="button" value="+1hr" onClick="">
<input type="button" value="+10min" onClick="">
<input type="button" value="+60sec" onClick="">
<input type="button" value="Start Alarm" onClick"alarmset()">
</body>
</html>