• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Date not getting displayed

 
prakash ke
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a html page wherein i want to the date. If I open the html file with any browser it's displaying correctly. But when I put it in server it's not working.

My script goes like this

<P>Payment is due on <script type="text/javascript">
<!--
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
document.write(month + "/" + day + "/" + year)
//-->
</script>.</P>

 
Zandis Murāns
Ranch Hand
Posts: 174
Java Java ME Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I'm not really sure about this but does not everything between <!-- and --> is not comment?
Anyways, your javascript is not valid. Every line of code in javascript must end with semicolon, I can clearly see that your's doen't.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Zandis Murāns wrote:Actually I'm not really sure about this but does not everything between <!-- and --> is not comment?

Does not effect the JavaScript and it is not needed.

Zandis Murāns wrote:Anyways, your javascript is not valid. Every line of code in javascript must end with semicolon, I can clearly see that your's doen't.

This is incorrect, JavaScript does not need semicolons.

Eric
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
prakash ke wrote:But when I put it in server it's not working.


Any errors?

Are you cached? Clear the cache and try again.

Eric
 
Zandis Murāns
Ranch Hand
Posts: 174
Java Java ME Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Pascarello wrote:
Zandis Murāns wrote:Anyways, your javascript is not valid. Every line of code in javascript must end with semicolon, I can clearly see that your's doen't.

This is incorrect, JavaScript does not need semicolons.

Eric

I agree with you now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic