Forums

This topic is locked

JS getFullYear() Error

Posted 30 Sep 2003 18:33:40
1
has voted
30 Sep 2003 18:33:40 Katherine Williams posted:
Hello,

Here's the basics of my problem, and I'm hoping that someone sees something simple in what I'm doing wrong:

<b>IN &lt;HEAD&gt; OF DOC:</b>
&lt;script type="text/javascript"&gt;
function year(){
var d = new Date();
var yr = d.getFullYear();
document.write(yr);}
&lt;/script&gt;

<b>IN &lt;BODY&gt; OF DOC:</b>
&lt;input type="hidden" name="hfYear" value="year()"&gt;

<b>RESULTS IN:</b>
2003undefined

I of course only need the full year of 2003. Can anyone see what I'm doing wrong. Any and help is appreciated. Thanks.

KWilliams

Reply to this topic