• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Date not getting displayed

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>

 
Ranch Hand
Posts: 174
Java ME Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ME Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't MAKE me come back there with this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic