can't figure out how to link my javascript into my html -


i"m trying follow tutorial online on how make todo list

i finished following code follows

<!doctype html> <html>     <head>     <title>to list html , javascript</title>     <style>     ul { list-style: none; padding: 0; margin: 0; width: 400px;}     li { border: 1px solid #ccc; background: #eee; padding: 5px 10px; color: #000; }     li span { padding-left: 10px; cursor: default;}     .checked { text-decoration: line-through; font-weight: bold; color: #c00;}          </style>     </head>     <body>  <h1>to list</h1> <p><iput type="text" id="initemtext"/>     <ul id= "todolist">  </ul>   <script type= "text/javascript" src="todo.js"</script>      </body> </html> 

and

// each item should <li><input type = "checkbox"/> tutorial</li>   function updateitemstatus (){      var cbid = this.id.replace("cb_","");     var itemtext = document.getelementbyid("item_" + cb.id);      if (this.checked) {         itemtext.classname = "checked"; }   else {         itemtext.style.fontweight = ""; }  }   function removeitem(){     var spanid = this.id.replace("item","");     document.getelementbyid("li_" + spanid).style.display = "none"; }   function addnewitem(list, itemtext){      var date = new date ();     var id = "" + date.gethours() + date.getminutes() + date.getseconds() + date.getmilliseconds(); ;      var listitem = document.createelement("li");     list.item.id = "li_" + id;      var checkbox = document.createelement("input");     checkbox.type = "checkbox";     checkbox.id = "cb_" + id;     checkbox.oneclick = updateitemstatus;       var span = document.createelement("span");     span.id = "item_" + id;     span.innertext = itemtext;     span.ondblclick = removeitem;      listitem.appendchild(checkbox);     listitem.appendchild(span)       list.appendchild(listitem);  }   var initemtext = document.getelementbyid("initemtext"); initemtext.focus(); initemtext.onkeyup = function (event) {      // 13 means enter      if (event.which == 13) {     var itemtext = event.which;      if (itemtext == "" || itemtext == " ") {         return false;     }      addnewitem(document.getelementbyid("todolist") itemtext);      initemtext.focus();     initemtext.select();  }; 

i have both files saved in save folder on desktop. javascript still not coming up. did type in wrong. i'm trying how link javascript html sorry first time doing this.

you forgot >

<script type= "text/javascript" src="todo.js"></script> 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -