JavaScript question - نوشته شده در (3067 Views)
Junior Member
borge
مطلب: 185
185
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.
Code:
<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
 پیش‌فرض مرتب‌سازی برای تاریخ DESC به معنی جدیدترین است  
 تعداد در صفحه 
نوشته شده در
Average Member
phy1729
مطلب: 589
589
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.<
نوشته شده در
Junior Member
borge
مطلب: 185
185
Thanks, that fixed it smile<
borge
نوشته شده در
Average Member
phy1729
مطلب: 589
589
You're welcome.<
 
شما باید یک متن وارد کنید