Jump to content


Photo

Does not show


  • Please log in to reply
3 replies to this topic

#1 Hellusius

Hellusius
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 04 August 2006 - 01:31 PM

I made a little date script as you can see:

<script language="JavaScript">
<!-- script
var date=new Date();
var day=date.getday();
var month=date.getMonth()+1;
var year=date.getFullYear();
document.write("The Date is:"+Day+" - "+month+" - "+year+");
// script -->
</script>

The problem is, that it doesn't show, and I don't see what I did wrong either.

#2 nogray

nogray
  • Members
  • PipPipPip
  • Advanced Member
  • 930 posts
  • LocationSan Francisco CA

Posted 04 August 2006 - 04:15 PM

Javascript is case senstive, so your getday() function should be getDay() and in the document.write, the Day should be day. Also, there is an extra " after the year
<script language="JavaScript">
<!-- script
var date=new Date();
var day=date.getDay();
var month=date.getMonth()+1;
var year=date.getFullYear();
document.write("The Date is:"+day+" - "+month+" - "+year);
// script -->
</script>

NoGray.com


#3 Hellusius

Hellusius
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 04 August 2006 - 05:11 PM

Thanks for the header, forgot those, btw how can I put a 0 before it if it lower than 10, do I need a make an if/then/else for it or is there a shorter way?

#4 nogray

nogray
  • Members
  • PipPipPip
  • Advanced Member
  • 930 posts
  • LocationSan Francisco CA

Posted 04 August 2006 - 05:39 PM

if/else will do just fine, just remmeber to put the 0 in quotes "0" so it's a string and not a number.

NoGray.com





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users