rap8557
Banned - Selling via PM
- Sep 15, 2008
- 2,000
- 631
So im trying to add a random pop up text automatically after random time without reloading a page,
The var Product can be added a lot of product or removed, i tried this code but it didn't work.
The script is only getting 1 country 1 number and 1 product, and not changing automatically. You need to reload the page in order to change.
Please help
Thanks
Code:
<p class="custom-notification-content">
Someone from
<script>var Country = ['Edmonton, Canada', 'California, United States', 'New Jersey, United States','Birmingham, United Kingdom', 'Melbourne, Australia', 'Paris, France'];
var randCountry = Country[Math.floor(Math.random() * Country.length)];
document.write(randCountry);</script>
<br>Purchased <b>
<script>var randNumber = Math.floor(Math.random() * 9) + 1; document.write(randNumber);</script><script>var Zeros = ['0', '00', '000'];
var randZeros = Zeros[Math.floor(Math.random() * Zeros.length)];
document.write(randZeros);</script></b>
<script>var Product = ['apple','grapes','comb','hat'];
var randProduct = Product[Math.floor(Math.random() * Product.length)];
document.write(randProduct);</script>
<small>(<script>var randNumber = Math.floor(Math.random() * 5) + 2; document.write(randNumber);</script> hours ago)</small>
</p>
The var Product can be added a lot of product or removed, i tried this code but it didn't work.
The script is only getting 1 country 1 number and 1 product, and not changing automatically. You need to reload the page in order to change.
Please help
Thanks