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 <HEAD> OF DOC:</b>
<script type="text/javascript">
function year(){
var d = new Date();
var yr = d.getFullYear();
document.write(yr);}
</script>
<b>IN <BODY> OF DOC:</b>
<input type="hidden" name="hfYear" value="year()">
<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