Advertisement
Guest User

Visited Sites

a guest
Sep 8th, 2020
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve() {
  2.  
  3.  
  4.  let softUniClicked = document.querySelectorAll(`.link-1`)[0]
  5.   let googleClicked = document.querySelectorAll(`.link-1`)[1];
  6.   let youTudeCicked = document.querySelectorAll(`.link-1`)[2];
  7.   let wikiClicked = document.querySelectorAll(`.link-1`)[3];
  8.  let gmailClicked = document.querySelectorAll(`.link-1`)[4];
  9.   let stackClicked = document.querySelectorAll(`.link-1`)[5];
  10.  let pCreateSoft = document.getElementsByTagName(`p`)[0]
  11.   let pCreateGoog = document.getElementsByTagName(`p`)[1];
  12.   let pCreateYouTude = document.getElementsByTagName(`p`)[2];
  13.   let pCreateWiki = document.getElementsByTagName(`p`)[3];
  14.   let pCreateGmail = document.getElementsByTagName(`p`)[4];
  15.   let pCreateStack = document.getElementsByTagName(`p`)[5];
  16.  
  17.  
  18.  
  19.  
  20. softUniClicked.addEventListener(`click`, () => {
  21.   let counter = pCreateSoft.textContent.split(` `)[1]
  22.   counter++;
  23.  
  24.  
  25.   pCreateSoft.innerHTML = `visited ${counter} times`
  26. })
  27.  
  28. googleClicked.addEventListener(`click`, () => {
  29.   let counter = pCreateGoog.textContent.split(` `)[1]
  30.   counter++;
  31.  
  32.  
  33.   pCreateGoog.innerHTML = `visited ${counter} times`
  34. })
  35.  
  36. youTudeCicked.addEventListener(`click`, () => {
  37.   let counter = pCreateYouTude.textContent.split(` `)[1]
  38.   counter++;
  39.  
  40.  
  41.   pCreateYouTude.innerHTML = `visited ${counter} times`
  42. })
  43.  
  44. wikiClicked.addEventListener(`click`, () => {
  45.   let counter = pCreateWiki.textContent.split(` `)[1]
  46.   counter++;
  47.  
  48.  
  49.   pCreateWiki.innerHTML = `visited ${counter} times`
  50. })
  51.  
  52. gmailClicked.addEventListener(`click`, () => {
  53.   let counter = pCreateGmail.textContent.split(` `)[1]
  54.   counter++;
  55.  
  56.  
  57.   pCreateGmail.innerHTML = `visited ${counter} times`
  58. })
  59.  
  60. stackClicked.addEventListener(`click`, () => {
  61.   let counter = pCreateStack.textContent.split(` `)[1]
  62.   counter++;
  63.  
  64.  
  65.   pCreateStack.innerHTML = `visited ${counter} times`
  66. })
  67.  
  68.  
  69.  
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement