Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 JavaScript question
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

borge
Junior Member

Norway
185 Posts

Posted - 04 May 2008 :  05:53:06  Show Profile  Reply with Quote
I have been using a small JavaScript to display the current year. It is working well with IE, but I recently discovered that it is not displaying right in Mozilla Firefox.

<SCRIPT language="JavaScript">
<!-- 
var today_date= new Date()
var myyear=today_date.getYear()
document.write(myyear)
--> 
</script>


Does anyone know what I should so to fix it, or a better way of accomplishing what this script is supposed to do?<

borge

phy1729
Average Member

USA
589 Posts

Posted - 04 May 2008 :  10:51:01  Show Profile  Reply with Quote
That works fine for me in FF 2.0.0.14 but you may want getFullYear() which will return 2008 not 108 and comment out the --> by using //-->. If you're using a xhtml doctype get rid of the comment altogether because anything in a comment can be ignored by a parser.<
Go to Top of Page

borge
Junior Member

Norway
185 Posts

Posted - 04 May 2008 :  14:47:47  Show Profile  Reply with Quote
Thanks, that fixed it <

borge
Go to Top of Page

phy1729
Average Member

USA
589 Posts

Posted - 04 May 2008 :  15:30:11  Show Profile  Reply with Quote
You're welcome.<
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.1 seconds. Powered By: Snitz Forums 2000 Version 3.4.07