| Author |
Date not getting displayed
|
prakash ke
Greenhorn
Joined: Apr 20, 2011
Posts: 7
|
|
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
Joined: Aug 18, 2009
Posts: 174
|
|
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
Joined: Nov 08, 2001
Posts: 15357
|
|
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
Joined: Nov 08, 2001
Posts: 15357
|
|
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
Joined: Aug 18, 2009
Posts: 174
|
|
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.
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: Date not getting displayed
|
|
|