html - Javascript not showing in browser -
i new javascript. reading book following code. somehow, not showing date expect in browser regardless of whether use safari, or chrome or explorer.
can what's wrong it? have tried moving javascript body etc... still same problem.
thanks
<html> <head> <title>my first web testing</title> </head> <body> testing <script type="text/javascript> var today = new date(); var dd = today.getdate(); var mm = today.getmonth()+ 1; var yyyy = today.getfullyear(); if(dd<10) dd = '0' + dd; if(mm<10) mm = '0' + mm; today = dd + '-' + mm + '-' + yyyy; document.write("<b>" + today + "</b>"); </script> </body> </html>
you forgot end quotation mark in script declaration.
should be
<script type="text/javascript">
Comments
Post a Comment