From 9148fa6e2fad9d54e3451a4478e03f55f0a9fa3c Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Sun, 16 May 2021 21:38:59 -0500 Subject: Rearrange files --- OLD/csci4131/lec/lec7big3/RandomPicture.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 OLD/csci4131/lec/lec7big3/RandomPicture.js (limited to 'OLD/csci4131/lec/lec7big3/RandomPicture.js') diff --git a/OLD/csci4131/lec/lec7big3/RandomPicture.js b/OLD/csci4131/lec/lec7big3/RandomPicture.js new file mode 100644 index 0000000..b5f4d73 --- /dev/null +++ b/OLD/csci4131/lec/lec7big3/RandomPicture.js @@ -0,0 +1,21 @@ +var iconImg; + +function randImage() { + var index = Math.floor(Math.random()*7); + + var pictures = ["CPE", "EPT", "GPP", "GUI", "PERF", "PORT", "SEO"]; + var descriptions = ["Common Programming Error", + "Error-Prevention Tip", "Good Programming Practice", + "Look-and-Feel Observation", "Performance Tip", "Portability Tip", + "Software Engineering Observation"]; + + iconImg.src = pictures[index] + ".png"; + iconImg.alt = descriptions[index]; +} + +function start() { + iconImg = document.getElementById("image"); + iconImg.addEventListener("click", randImage, false); +} + +window.addEventListener("load", start); \ No newline at end of file -- cgit v1.2.3