Also, I probably have other errors as well, so if you could suggest any other corrections to my code, that would be great!
The error states that the object is required on line 2, character 1.
The following code is all the Javascript code I have in the head section of my HTML document so far...
Expand|Select|Wrap|Line Numbers
- <script type="text/javascript">
- var command=document.getElementById('tc').innerHTML;
- function checkCommand() {
- if (command=="add todo") {
- addToDo();
- }
- }
- function startTime() {
- var today=new Date();
- var h=today.getHours();
- var m=today.getMinutes();
- var s=today.getSeconds();
- m=checkTime(m);
- s=checkTime(s);
- document.getElementById('time').innerHTML=h+":"+m+":"+s;
- t=setTimeout('startTime()',500);
- }
- function checkTime(i) {
- if (i<10) {
- i="0" + i;
- }
- return i;
- }
- function myDate() {
- var d=new Date();
- var year=d.getFullYear();
- var month=d.getMonth()+1;
- var date=d.getDate();
- document.getElementById('date').innerHTML=month+"/"+date+"/"+year;
- }
- function addToDo() {
- var input=prompt("Type what you need To-Do...","Make it short please!");
- var tdv=document.getElementById('todo').innerHTML;
- if (tdv.length>0) {
- tdv=tdv+"<br />"+input;
- }
- else {
- tdv=input;
- }
- }
- </script>