Help with incorrect html coding?

Michael

New member
I currently use the code below in a html file. The idea is to select a file from a directory, with directory based on a year and file based on a month. The directory and file are numbers.

<script language="JavaScript">
getyear()
getmonth()
</script>
<script language="vb">
Let var $year = getyear()
Let var $month = getmonth()
Let var $calendar = "$year"+"/"+"$month"
<link href ="/Calendar/$calendar.html">
</script>

The problem is this code does not work. Does anyone have a suggestion to correct it?

Thanks

Michael
 
<script language="JavaScript">
var d = new Date();
var m = d.getMonth()+1;
var y = d.getYear();
document.write('<link href="/Calendar/' + y + '/' + m + '.html">');
document.write('<a href="/Calendar/' + y + '/' + m + '.html">Click here</a>');
</script>

The functions "getMonth" and "getYear" need to be called from a "Date" object.

The dollar sign ($) is not used for variable names in JavaScript.

Your code is using "link" which will not display anything on the page, so I added the "a" tag in case you were looking to make a clickable link.
 
<script language="JavaScript">
var d = new Date();
var m = d.getMonth()+1;
var y = d.getYear();
document.write('<link href="/Calendar/' + y + '/' + m + '.html">');
document.write('<a href="/Calendar/' + y + '/' + m + '.html">Click here</a>');
</script>

The functions "getMonth" and "getYear" need to be called from a "Date" object.

The dollar sign ($) is not used for variable names in JavaScript.

Your code is using "link" which will not display anything on the page, so I added the "a" tag in case you were looking to make a clickable link.
 
Back
Top