I am trying to call an external Javascript file as the Javascript for my HTML document. But I get this error: SyntaxError: Unexpected token "<" on line 1. So clearly it is acknowledging the file. But what I don't understand why it is throwing an error. I looked around and it seems no one else is has ever gotten this problem.
This is the HTML document:
<!DOCTYPE html>
<html>
<head>
<title>Testing</title>
<script src="displaydate.js" type="text/javascript">
</script>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.<br>
<a href=http://www.google.com>google</a>
</p>
</body>
</html>
This is my Javascript:
<script type='text/javascript'>
function todaydate(){
var today_date= new Date();
var myyear=today_date.getYear();
var mymonth=today_date.getMonth()+1;
var mytoday=today_date.getDate();
alert(myyear+"//"+mymonth+"//"+mytoday);
}
</script>