i am writing javascript code on nodepad++,i am at beginner level and write just this code
<html>
<body>
<script type="text/javascript">
var d=new Date();
var time=d.getHours();
if(time<10)
{
document.write("<b> good morning </b>");
}
else
{
document.write ("<b> good afternoon </b>");
}
</script>
</body>
</html>
then from editor nodepad++,i clicked run in google chrome,but got only this
<html>
<body>
<script type="text/javascript">
var d=new Date();
var time=d.getHours();
if(time<10)
{
document.write("<b> good morning </b>");
}
else
{
document.write ("<b> good afternoon </b>");
}
</script>
</body>
</html>
copy of code and not result,why?
I think you saved your file as
txtand not ashtml. Then the browser would only show you the content and do not render the code.Save it as HTML File and your problem should be solved.