Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- images = ["i1.jpg", "i2.jpg", "i3.png", "i4.png", "i5.png"];
- texts = ["Fuck", "Dr", "Sarah", "And her", "Course"];
- idx = 0;
- img1;
- p1;
- intervalId = -1;
- function work() {
- img1.src = images[idx];
- p1.innerText = texts[idx];
- idx++;
- idx %= images.length;
- }
- function cont() {
- intervalId = setInterval(work, 3000);
- }
- function pse() {
- if (intervalId === -1) { return; }
- clearInterval(intervalId);
- intervalId = -1;
- }
- function prepare() {
- img1 = document.getElementById("img1");
- p1 = document.getElementById("p1");
- var btnContinue = document.querySelector("input[type=\"button\"][value=\"Continue\"]");
- var btnPause = document.querySelector("input[type=\"button\"][value=\"Pause\"]");
- btnContinue.onclick = cont;
- btnPause.onclick = pse;
- cont();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement