< !-- Script by hscripts.com --> <script type="text/javascript"> var arr= new Array(); arr.push("Javascript is a client-side scripting language"); arr.push("Javascript is different from Java"); arr.push("CSS - Cascading Style Sheet"); arr.push("HTML is a platform independent language"); function rotate() { var num= Math.round(Math.random()*3); add(num); } function add(i) { var chi = document.createTextNode(arr[i]); var tab1 = document.getElementById("add1"); while(tab1.hasChildNodes()) { tab1.removeChild(tab1.firstChild); } tab1.appendChild(chi); } </script> < !-- Script by hscripts.com -->
HTML Code
<table align=center style="background-color:#C0C0C0";> <tr> <td background-color:#C0C0C0 align=center width=300 style="font-family:Times New Roman;"> <b>Random Quote Generator </td> </tr> <tr> <td id=add1 class=row width=300 align=center>Click Next to Display Random message</td> </tr> <tr><td align=center> <input type=button value="Next" border=0 onclick="rotate()"></td></tr> </table>