javascript - How can I easily repeat an html element on a page thousands of times? -
How can I replicate an HTML element thousands of times and add everyone to my web page?
For example, suppose I want to display the same word, test
, one thousand times on my page. Do I have to type in & lt; P & gt; Trial & lt; / P & gt;
is required to write or can I use a javascript function like the following:
For (var i = 0; i
test
more easily?
Not the best answer. But this is good. Nice and simple way
& lt; P id = "sample" & gt; & Lt; / P & gt; & Lt; Script type = "text / javascript" & gt; (I = 0; i <1000; i ++) for {document.getElementById ("sample"). InnerHTML + "" & lt; Br> Exam ";} & lt; / script & gt;
Comments
Post a Comment