diff --git a/Week-3/Homework/mandatory/1-alarmclock/alarmclock.js b/Week-3/Homework/mandatory/1-alarmclock/alarmclock.js index 6ca81cd..5aefb28 100644 --- a/Week-3/Homework/mandatory/1-alarmclock/alarmclock.js +++ b/Week-3/Homework/mandatory/1-alarmclock/alarmclock.js @@ -1,4 +1,45 @@ -function setAlarm() {} + +function setAlarm() { + //Selectors + let inputValue=document.getElementById("alarmSet"); + let timer=inputValue.value; + let timeRemaining=document.querySelector("#timeRemaining"); + + + let stopButton=document.querySelector("#stop"); + //eventListener + + + let clock =setInterval(countDown,1000); + +function countDown(){ + + +if (timer<0){ + inputValue.value=""; + playAlarm(); +} +else { + if (timer>=10){ + timeRemaining.textContent=`time Remaining: 00:${timer}`; + timer--; + + } + else{ + timeRemaining.textContent=`time Remaining: 00:0${timer}`; + timer--; + } +} +} + +stopButton.addEventListener("click", () => { +clearInterval(clock); +pauseAlarm(); +}); + + + +} // DO NOT EDIT BELOW HERE diff --git a/Week-3/Homework/mandatory/1-alarmclock/index.html b/Week-3/Homework/mandatory/1-alarmclock/index.html index ab7d582..9a5b084 100644 --- a/Week-3/Homework/mandatory/1-alarmclock/index.html +++ b/Week-3/Homework/mandatory/1-alarmclock/index.html @@ -2,7 +2,7 @@ Alarm Clock - + Quote Generator - + +
+

+test quote

+

test autor

+ +
+ diff --git a/Week-3/Homework/mandatory/2-quotegenerator/quotes.js b/Week-3/Homework/mandatory/2-quotegenerator/quotes.js index 39ab245..e1fe09d 100644 --- a/Week-3/Homework/mandatory/2-quotegenerator/quotes.js +++ b/Week-3/Homework/mandatory/2-quotegenerator/quotes.js @@ -1,3 +1,14 @@ + +let h1E1=document.getElementById("myH1"); +let pE1=document.getElementById("myP"); +let buttonE1=document.getElementById("myButton"); + +buttonE1.addEventListener("click", () => { + const number = Math.floor(Math.random()* quotes.length); + h1E1.textContent = quotes[number].quote; + pE1.textContent= quotes[number].author; + +}); // DO NOT EDIT BELOW HERE // A function which will return one item, at diff --git a/Week-3/Homework/mandatory/3-slideshow/images/cat1.jpg b/Week-3/Homework/mandatory/3-slideshow/images/cat1.jpg new file mode 100644 index 0000000..e8b716e Binary files /dev/null and b/Week-3/Homework/mandatory/3-slideshow/images/cat1.jpg differ diff --git a/Week-3/Homework/mandatory/3-slideshow/images/cat2.jpg b/Week-3/Homework/mandatory/3-slideshow/images/cat2.jpg new file mode 100644 index 0000000..1bd9b18 Binary files /dev/null and b/Week-3/Homework/mandatory/3-slideshow/images/cat2.jpg differ diff --git a/Week-3/Homework/mandatory/3-slideshow/images/cat3.jpg b/Week-3/Homework/mandatory/3-slideshow/images/cat3.jpg new file mode 100644 index 0000000..807ba4f Binary files /dev/null and b/Week-3/Homework/mandatory/3-slideshow/images/cat3.jpg differ diff --git a/Week-3/Homework/mandatory/3-slideshow/images/cat4.jpg b/Week-3/Homework/mandatory/3-slideshow/images/cat4.jpg new file mode 100644 index 0000000..1699b95 Binary files /dev/null and b/Week-3/Homework/mandatory/3-slideshow/images/cat4.jpg differ diff --git a/Week-3/Homework/mandatory/3-slideshow/index.html b/Week-3/Homework/mandatory/3-slideshow/index.html index 39cd40e..d5a4ad3 100644 --- a/Week-3/Homework/mandatory/3-slideshow/index.html +++ b/Week-3/Homework/mandatory/3-slideshow/index.html @@ -2,7 +2,7 @@ Slideshow - + - +
+ + + + + + +
diff --git a/Week-3/Homework/mandatory/3-slideshow/slideshow.js b/Week-3/Homework/mandatory/3-slideshow/slideshow.js index b55091c..d572655 100644 --- a/Week-3/Homework/mandatory/3-slideshow/slideshow.js +++ b/Week-3/Homework/mandatory/3-slideshow/slideshow.js @@ -1 +1,27 @@ -// Write your code here +let catIndex1 = 4; +let catIndex2 = 0; +let catRevCount = 4; +let catForCount = 0; +let catReverse; +let catForward; +let catArray = ["images/cat1.jpg", "images/cat2.jpg", "images/cat3.jpg", "images/cat4.jpg"]; +let autoRev = document.getElementById("autoRev"); +autoRev.addEventListener("click", function () { + catReverse = setInterval(() => { + document.getElementById("images").src = catArray[catIndex1]; + catIndex1--; + if(catIndex1 === catArray.length-4) { + catIndex1 = 4; + } + }, 2000); +}) +let autoFor = document.getElementById("autoFor"); +autoFor.addEventListener("click", function () { + catForward = setInterval(() => { + document.getElementById("images").src = catArray[catIndex2]; + catIndex2++; + if (catIndex2 === 4) { + catIndex2 = 0; + } + }, 2000); +})