View Full Version : help creating random text generator upon click

10-24-2008, 02:46 AM
Hello everyone this is my first time posting here.

I have a question I have been searching for the answer but haven't found it

I am hoping I phrase this so it makes sense but I want to create a script for a page on my portfolio site that effectively when open has a sentence like " Hello my name is Chris Grover and ........." where the ......... upon being clicked say different things I program to put in there, so it randomizes lots of different phrase endings.

My Q...what where how do I do this? :)

I am learning php, js, css, etc at a beginners rate. So I know some of the language but not a lot, any help would be greatly appreciated. Thanks! -Chris

10-24-2008, 06:56 AM
<script type="text/javascript">
var randomize={
'he is Raymond Angana aka rangana',
'Antarctica is the only continent without reptiles or snakes.',
'I saw another gibberish',
'I saw this script in DD Forums',
'I saw another message' // Last phrase should not contain a comma
] // Initialize he phrase within the brackets
var genNum=Math.floor(Math.random()*this.aPhrases.length); // Generate random number
<style type="text/css">
Hello my name is Chris Grover and <span id="el">this is the default message</span>.
<input type="button" value="Randomize" onclick="randomize.init()">

10-26-2008, 11:01 AM
Thank you I'm going to test this out right now.