I have an HTML file, and a JavaScript file in the same directory. I have variables in the JS file specifically for easier access to modify. My goal is to have the page load those variables and use them to change element attributes. In Inspect Element, if I click the JavaScript reference in the < head > tag, it takes me to the JavaScript file as it should, so I don't understand why the HTML file won't load it. I feel like there's something small that I'm missing so if you could point it out for me, that would be great. Thanks.
links.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Lil Ses & Rony</title>
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700" rel="stylesheet">
<link rel="stylesheet" href="links.css">
<script type="text/javascript" src="https://linkupapp.org/links.js"></script>
</head>
<body onload="jsUpdate()">
<!-- Logo -->
<img class="logo" src="links logo.jpg" />
<!-- Name -->
<h2>Lil Ses & Rony</h2>
<a name="spotify" href="">no value</a>
<a name="appleMusic" href="">no value</a>
<a name="youTube" href="">no value</a>
<a name="soundCloud" href="">no value</a>
<a name="twitter" href="">no value</a>
</body>
</html>
links.js
var songTitle = "Runaway";
var spotify = "spotify:track:1TsKB26M4Tz2JrC56uZo2z";
var appleMusic = "https://music.apple.com/ca/album/runaway/1502683420?i=1502683423";
var youTube = "https://youtu.be/3Zmm4e3ysjY";
var soundCloud = "https://soundcloud.com/user-887966595/runaway-prod-secret";
var twitter = "https://www.twitter.com/lilsesandrony";
var links = {
spotify : {
title : songTitle + " (Spotify)",
link : spotify
},
appleMusic : {
title : songTitle + " (Apple Music)",
link : appleMusic
},
youTube : {
title : songTitle + " (YouTube)",
link : youTube
},
soundCloud : {
title : songTitle + " (SoundCloud)",
link : soundCloud
},
twitter : {
title : "Twitter",
link : twitter
}
};
function jsUpdate() {
var ref = {
spotify : document.getElementsByName("spotify"),
appleMusic : document.getElementsByName("appleMusic"),
youTube : document.getElementsByName("youTube"),
soundCloud : document.getElementsByName("soundCloud"),
twitter : document.getElementsByName("twitter"),
};
ref.spotify.innerHtml = links.spotify.title;
ref.spotify.href = links.spotify.link;
ref.appleMusic.innerHtml = links.appleMusic.title;
ref.appleMusic.href = links.appleMusic.link;
ref.youTube.innerHtml = links.youTube.title;
ref.youTube.href = links.youTube.link;
ref.soundCloud.innerHtml = links.soundCloud.title;
ref.soundCloud.href = links.soundCloud.link;
ref.twitter.innerHtml = links.twitter.title;
ref.twitter.href = links.twitter.link;
}