I've tried to solve my problem with the help of multiple teachers at my school, but I was told they don't know what has caused the problem was and I should try fixing it by trial and error. Also I've tried several JavaScript Error checkers on other sites, which gave me good feedback/warnings of what I was doing wrong and how I could improve my JavaScript, but didn't solve my problem.
My problem
In my HTML my script element doesn't find my script.js
. Because I have multiple tasks at school to complete, I copy and paste my files and modify the copied ones. and in all other files this code worked well, until this one.
HTML > index.html
<!doctype HTML>
<html lang=nl>
<head>
<title> JS lab </title>
<meta charset=utf-8>
<meta name="description" content="Javascript">
<meta name="author" content="Niels Langeweg">
<!-- <link rel="stylesheet" href="style.css"> -->
</head>
<body>
<script type="text/javascript" src="script.js">
// using script.js
//document.writeln("current day is " + currentDay() );
useMe();
</script>
</body>
</html>
JavaScript > script.js
// script.js
function currentDayNumber(){
var date = new Date();
return(date.getDay());
}
function day( value ) {
var days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
return (days[value]);
}
function currentDay() {
return day(currentDayNumber());
}
function randomLession () {
var value = new Array();
value = ["English", "Science", "Mathematics", "Latin", "IT", "Spanish"];
}
function getSchedule () {
var schedule = new Array();
for (var i = 0; i < 7; i++){
schedule[i] = new Array();
for(var u = 0; u < 8; u++){
schedule[i][u] = "";
}
}
}
Folder
myTask -> index.html
-> script.js