DestinysEnd
06-30-2012, 09:43 PM
so im working on a few projects rite now, my main issue I have come across is the count down clock im trying to do, im not to well spoken when it comes to javascript or any coding language above css, but im learning,
I did manage to find a small part of what im looking for as far as counting down will go. I have tried adding an additional varible, and if statements but I cannot seem to get the minutes on my clock.
im initally wanting it to show like 00:00:00
I know how to display it in its own pop up and all,
but I dont know how do to some of the harder parts,
the full way I need it done is, from top to bottom left to right
first line: text box that starts out displaying 00:00:00 and are able to edit it for your own time and a start/stop button next to it
second line: 2 buttons, 5 min and 15 min
third line: 2 buttons 30 min and 60 min
im trying to get the buttons to output their value to the text box when they are clicked and to start counting down when you click start
when it reaches 0 I have an alert box that will pop up but dont know how to put it in javascript,
and a timer to count how long the 1st alert box was up and to be displayed in a second alert box to show how long they were over
I know it can be done
but all I have is this so far
I dont mind doing the coding myself, if someone would show me or explain what needs to be done
========================================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="language" content="english">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title>simple countdown</title>
<style type="text/css">
form {
text-align:center;
}
input {
font-family:monospace;
font-size:18px;
font-weight:bold;
text-align:center;
background-color:#f0f0f0;
}
</style>
<script type="text/javascript">
/*** these values are editable ***/
var milisec=0;
var seconds=0;
/********************************/
var zero=null;
var temp=seconds+':'+milisec+'0';
function display(){
if(seconds<10){
zero='0';
}
document.forms[0][0].value=zero+seconds+':'+milisec+'0';
if(milisec<=0){
milisec=10;
seconds--;
}
if(seconds<0){
return;
}
milisec--
setTimeout(function(){display()},100)
}
window.addEventListener?
window.addEventListener('load',display,false):
window.attachEvent('onload',display);
</script>
</head>
<body>
<form action="#">
<div>
<input type="text" size="8">
</div>
</form>
</body>
</html>
I did manage to find a small part of what im looking for as far as counting down will go. I have tried adding an additional varible, and if statements but I cannot seem to get the minutes on my clock.
im initally wanting it to show like 00:00:00
I know how to display it in its own pop up and all,
but I dont know how do to some of the harder parts,
the full way I need it done is, from top to bottom left to right
first line: text box that starts out displaying 00:00:00 and are able to edit it for your own time and a start/stop button next to it
second line: 2 buttons, 5 min and 15 min
third line: 2 buttons 30 min and 60 min
im trying to get the buttons to output their value to the text box when they are clicked and to start counting down when you click start
when it reaches 0 I have an alert box that will pop up but dont know how to put it in javascript,
and a timer to count how long the 1st alert box was up and to be displayed in a second alert box to show how long they were over
I know it can be done
but all I have is this so far
I dont mind doing the coding myself, if someone would show me or explain what needs to be done
========================================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="language" content="english">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title>simple countdown</title>
<style type="text/css">
form {
text-align:center;
}
input {
font-family:monospace;
font-size:18px;
font-weight:bold;
text-align:center;
background-color:#f0f0f0;
}
</style>
<script type="text/javascript">
/*** these values are editable ***/
var milisec=0;
var seconds=0;
/********************************/
var zero=null;
var temp=seconds+':'+milisec+'0';
function display(){
if(seconds<10){
zero='0';
}
document.forms[0][0].value=zero+seconds+':'+milisec+'0';
if(milisec<=0){
milisec=10;
seconds--;
}
if(seconds<0){
return;
}
milisec--
setTimeout(function(){display()},100)
}
window.addEventListener?
window.addEventListener('load',display,false):
window.attachEvent('onload',display);
</script>
</head>
<body>
<form action="#">
<div>
<input type="text" size="8">
</div>
</form>
</body>
</html>