Can I display a random string into a HTML document? -
i have web page. i'd randomly switch between 2 different strings. easiest way of doing this?
<!-- begin #random part --> <section id="countdown"> <div class="countdown-background"> <h1>this first random string</h1> <h1>i'd second random string</h1> </div> <div class="clear"></div> <div class="countdown-background"> <p>here's first random string</p> <p>and here's second of second random string</p> </div> </section> <!-- end #random part -->
of course try using javascript.
<body> <p id="pp"> </p> <script> var strarray = new array("random string1","random string2","random string3"); randomnum = math.round(math.random()*2); para = document.getelementbyid('pp'); para.innerhtml = strarray[randomnum] </script> </body>
Comments
Post a Comment