Make quotes work on homepage

main
Jeffrey Elkner 11 months ago
parent 8d80f506f9
commit 765e29092e

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

@ -6,6 +6,7 @@
<link href='https://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet'> <link href='https://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet'>
<link href='https://fonts.googleapis.com/css?family=Ubuntu%20Condensed' <link href='https://fonts.googleapis.com/css?family=Ubuntu%20Condensed'
rel='stylesheet'> rel='stylesheet'>
<link rel="icon" type="image/x-icon" href="../images/favicon.ico">
<title>Welcome to elkner.net!</title> <title>Welcome to elkner.net!</title>
<style> <style>
@import url(css/elknernet.css); @import url(css/elknernet.css);
@ -18,18 +19,19 @@ function reportScreenWidth() {
} }
function showQuote() { function showQuote() {
console.log(quotes); let qnum = Math.floor(Math.random() * quotes.length);
let quoteElem = document.getElementById("quote"); let quoteElem = document.getElementById("quote");
let quoteAuthor = document.getElementById("qauthor"); let quoteAuthor = document.getElementById("qauthor");
quoteElem.innerHTML = quotes[0].quote; quoteElem.innerHTML = quotes[qnum].quote;
quoteAuthor.innerHTML = quotes[0].author; quoteAuthor.innerHTML = quotes[qnum].author;
} }
function init() { function init() {
showQuote(); showQuote();
reportScreenWidth(); reportScreenWidth();
} }
window.onload = init; window.onload = init;
window.onload = reportScreenWidth;
window.onresize = reportScreenWidth; window.onresize = reportScreenWidth;
</script> </script>
</head> </head>

@ -1,40 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Quotes</title>
<style>
@import url(css/elknernet.css);
</style>
<script src="js/quotes.js"></script>
<script>
function showQuote() {
let mainElem = document.getElementById("quotes");
console.log(mainElem);
mainElem.innerHTML = "Hellooooooo there ;-)";
}
function init() {
let loc = window.location.href;
let HTMLvalidLinkStr = 'http://validator.w3.org/check?uri=' + loc;
let CSSvalidLinkStr = 'http://jigsaw.w3.org/css-validator/validator?uri=' +
loc + '?profile=css3';
document.getElementById("vLink1").setAttribute("href", HTMLvalidLinkStr);
document.getElementById("vLink2").setAttribute("href", CSSvalidLinkStr);
showQuote();
}
window.onload = init;
</script>
</head>
<body>
<h1>Quotes</h1>
<main id="quotes">
</main>
<footer>
<a id="vLink1">
<strong> HTML </strong> Valid! </a> &nbsp;
<a id="vLink2">
<strong> CSS </strong> Valid! </a>
</footer>
</body>
</html>
Loading…
Cancel
Save