How to make the same line generated from the very beginning to the end of the HTML page using JS? enter image description here

like here, but even longer so that you have to scroll down for a long time.

Closed due to the fact that the essence of the question is incomprehensible by the participants AK , aleksandr barakin , Sergey Glazirin , 0xdb , Air 28 Sep '18 at 5:09 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • 2
    Sorry, what do you mean? .. it is not clear from the question what you need - Mikhail Rebrov
  • Attached an example in the description - valeria
  • What prevents to make it a cycle? - uzi_no_uzi

1 answer 1

const el = document.querySelector('#block') while (el.offsetHeight < window.innerHeight) { el.innerHTML += 'Строка <br>' } 
 <div id="block"> </div> 

or

 const el = document.querySelector('#block') while (el.offsetHeight < window.innerHeight) { el.textContent += 'Строка ' } 
 <div id="block"> </div> 

Good luck!

UPDATE: Can be without a loop, if you use repeat

 const el = document.querySelector('#block') const count = window.innerHeight / el.offsetHeight el.innerHTML = el.innerHTML.repeat(count) 
 <div id="block"> Строка <br> </div> 

  • Wow, thank you! helped out :) - valeria