Bob Avallone Bob Avallone - 5 months ago 8
Javascript Question

Javascript code only works in IE

I have this simple JavaScript code to find the current year. It only works in IE. I tried three other browsers . No error just nothing returned.

<SCRIPT LANGUAGE="JavaScript">
today = new Date()
var header = (customDateString(today))
header + ""
document.write(header)

</SCRIPT>

Answer

This may help you @bob

<script>
    var today = new Date(),
       header = today.getFullYear();

    document.write(header);
</script>