is there any mistake in code
-
<html> <body> <script type="text/javascript"> var date = new Date(); var time = date.getHours(); if (time > 12 ) { document.write("<b>Good Afternoon</b>"); } if (time > 17 && < 24) { document.write("<b>Good Evening</b>"); } else { document.write("<b>Good Morning</b>"); } </script> </body> </html> output is a blank page
-
<html> <body> <script type="text/javascript"> var date = new Date(); var time = date.getHours(); if (time > 12 ) { document.write("<b>Good Afternoon</b>"); } if (time > 17 && < 24) { document.write("<b>Good Evening</b>"); } else { document.write("<b>Good Morning</b>"); } </script> </body> </html> output is a blank page
if (time > 17 && < 24) should be if (time > 17 && time < 24) (apart from which, as it is, it will write bnth Good Afternoon and Good Morning...) May I suggest you use Firefox and open the error concole (Tools menu) - this will highlight such erros immediately and greatly help you in debugging your JavaScript code
-
<html> <body> <script type="text/javascript"> var date = new Date(); var time = date.getHours(); if (time > 12 ) { document.write("<b>Good Afternoon</b>"); } if (time > 17 && < 24) { document.write("<b>Good Evening</b>"); } else { document.write("<b>Good Morning</b>"); } </script> </body> </html> output is a blank page
-
I think the statement
if (time > 17 && < 24)
should read
if (time > 17 && time < 24)
Just say 'NO' to evaluated arguments for diadic functions! Ash
thanks bro its working now