Click to See Complete Forum and Search --> : Can anyone help me?


Dragonfly
11-04-2003, 04:45 PM
Okay, I'm going to admit it, I'm useless. I have only basic knowledge of HTML and java seems like double dutch... How can I change a random name generator like the one on javascript source so that it takes two names from a list andputs them together randomly ie not always a first name first and a surname second??? Please help!

Khalid Ali
11-04-2003, 05:24 PM
you will have to be more escriptive then this.

Dragonfly
11-05-2003, 09:32 AM
See, I said I was stoopid, good thing I aint blonde too!
I am going to have a go at adapting the javascript, if it don't work I will get more specific!
Cheers anyway!

Dragonfly
11-05-2003, 03:10 PM
Okay, can anyone tell me what I have done wong? I debugged it so that it would look the way I wanted it to, but I can't get it to put a random name from the lists into the empty field....help????? Pretty please!

Charles
11-05-2003, 03:17 PM
<script type="text/javascript">
<!--
Array.prototype.random = function () {return this[Math.floor(Math.random() * this.length)]};

lastName = ['Smith', 'Jones', 'White'];
firstName = ['Tom', 'Dick', 'Harry'];

alert ([firstName.random(), lastName.random()].join(' '));
// -->
</script>

Dragonfly
11-05-2003, 03:31 PM
Blonde moment coming up....where does that go? does it replace the bit at the top like i think it does?
I really appreciate you helping me!
Thanks for your time and patience

Dragonfly
11-05-2003, 03:52 PM
That doesn't work...do I have to specify something in the javascript at the bottom that tells the random name where to go??? What have I done wrong???

Charles
11-05-2003, 03:55 PM
Originally posted by Dragonfly
What have I done wrong??? Beats me. What do you want to do?

Dragonfly
11-05-2003, 03:59 PM
Hehehehe
Okay, I'm trying to write a Javascript that lets you choose a character name, but one that isn't gender specific, nor does it matter whether you end up being called Blue Dragon or Dragon Blue (not limited to first name list and a second surname list....trying to use the same list to do both) It looks ok on screen but clicking on the button doesnt make a random name appear in either of the boxes? Have I missed something? I'm pretty new to this and it all looks ok to me. It took me an hour to debug an earlier version, all I had done was miss out a bracket!!!