Javascript in HTML does not execute -
<html> <head> <title>test environment</title> </head> <body>  <script> document.bgcolor="#222222"; document.fgcolor="#11ee11";  document.writeln("test environment."); document.writeln("last update: " + document.lastmodified);  var today = new date(); var dd = today.getdate(); var mm = today.getmonth()+1; //january 0! var yyyy = today.getfullyear();  if(dd<10) {     dd='0'+dd }   if(mm<10) {     mm='0'+mm }   today = dd+'/'+mm+'/'+yyyy;   function enterexpenses(){     var _desc = window.prompt("what kind of expenses?");     var _amount = window.prompt("amount spent?");     var _entry = {type:_desc amount:_amount date:today};      document.writeln(_entry.date);     document.writeln(_entry.type);     document.writeln(_entry.amount); }   </script> <form> <button onclick="enterexpenses()">click me</button> </form>  </body> </html>   i hate guy asking others work can't figure out why doesn't work. i'm trying learn javascipt , i've completed codecademy course. i'm trying work , put use , can't figure out why script not executed.
anyone's expertise can borrow second?
maybe because of typo in line
var _entry = {type:_desc amount:_amount date:today};   you should separate object properties comma
var _entry = {type:_desc, amount:_amount, date:today};      
Comments
Post a Comment