Forum Moderators: open
Here is my code:
<SCRIPT LANGUAGE="Javascript"><!--
function text() {
};
text = new text();
number = 0;
// textArray
text[number++] = "random text 1"
text[number++] = "random text 2"
text[number++] = "random text 3"
text[number++] = "random text 4"
text[number++] = "random text 5"
// keep adding items here...
increment = Math.floor(Math.random() * number);
document.write(text[increment]);
//--></SCRIPT>
Thanks in advance!
add a <div> in your page source where you want to put this text. maybe like this:
<html>
<body>
<p>stuff on page</p>
<div id="DIVNAMEHERE"></div>
<p>more stuff here too</p>
</body>
</html>
then use this js line to plug in the data:
document.getElementById('DIVNAMEHERE').innerHTML=text[increment];
Of course, now I have another problem lol... I only want the JavaScript to execute onclick of a button, but right now it loads as the page loads. I'll figure that one out though.
Thanks again for the help!