javascript - jQuery / JS - add div to div per x seconds -
i have problem. don’t know enough javascript. can know nothing. need 1 script add ‘div’ ‘p’ per 1-5 seconds. tried did mistakes. :/
what want add (per seconds), it's one:
<img src="/flags/{random flag/number (1-100)}</.png" alt=""> user stole <i>{random number (1000, 2000, 3000) array)}</i> <img src="strawberry.png" class="nob img-rounded "> <i>{random number (1000, 2000, 3000) array)}</</i> <img src="orange.png" class="nob img-rounded "> <i>{random number (1000, 2000, 3000) array)}</</i> <img src="apple.png" class="nob img-rounded "> <i>{random number (1000, 2000, 3000) array)}</</i> <img src="banana.png" class="nob img-rounded "> <i>{random number (1000, 2000, 3000) array)}</</i> <img src="sandwich.png" class="nob img-rounded ">
where want add this:
<p class="activity-border"> {here} </p>
what visitors must see:
{random flag} user stole {random number} strawberry(picture), {random number} orange(picture), {random number} apple(picture),{ random number} banana(picture), {random number} sandwich(picture).
well if want time interval use js "setinterval" function, :
<script> //... setinterval(function() { //do stuff here; }, time_in_ms); //... </script>
so, in case should :
//in "do stuff part" document.getelementbyid('your_p_id').appendchild(your_new_node); //or jquery $('#your_p_id').append('your_div');
hope helps
maybe should have @ : settimeout or setinterval?
fiddle : http://jsfiddle.net/ddtyovwv/4/
Comments
Post a Comment