Name generator script

I have made a  complete name generator script to download and use as your own. The script contains a full functional HTML page with all necessary JavaScript code, HTML and CSS, and can be run in any browser.

The name generator script is a complete do-it-yourself name generator! Ready to run with or without changes. The script is a simplified version one of the one I use at all my name generators.

The script is thoroughly explained and commented in the download file. So it is very easy  to work with for everybody, even for beginners to web programming. If you like further explanation on how the script works visit my How to make a name generator tutorial, where i you through a only slightly more simple generator script.

To get up and running just download the script, change the text and change the word arrays to your likings.  And you got yourself your own personal name generator.

How to use the name generator script

Getting started

Download the name-generator-script.zip.

Or just visit the name generator script demo, right click the page. Select view source. Copy the source to a text-editor.
Save is at generator.html.

How to run it

It’s easy. Just open the html file with your favorite browser.

How to edit it

To edit this page open it with a text editor with syntax highlighting. I’ll strongly recommend notepadd++ a free, fast and flexible text editor, I also use myself.

Name Generator FAQ

No one yet. Guess the code must be  self-explanatory. ;)   Well seriously… if you need help just ask your questions below. I’ll try my best to help you.

EDIT: Well now the comments works as a FAQ.  Please check them to see if you question already has been asked.

How to get visitors on your new name generator

If you make a cool name generator, I might wanna make a review of it. Just write a comment and I’ll look into it.

How to host your new name generator

There’s several ways to host your new name generator.

If you want your own domain name there’s a lot of companies to choose from. If you stick to some of the bigger companies the hosting is often very reliable.

The price level is often low and sometimes you can get a free domain name with the hosting plan.

But you can also find free hosting, if you don’t want your own domain.  Just make sure the service you choose supports the running of JavaScript.

This entry was posted in Name generator stuff and tagged , , . Bookmark the permalink.

20 Responses to Name generator script

  1. Pingback: How to make a name generator « Name Generators Blog

  2. Pingback: Roll your own | Danish webdesign - Copenhagen based freelance webdesigner Thomas Fals

  3. Pingback: Name generator widget « Name Generators Blog

  4. Pingback: Navnegenerator | Blog om webudvikling

  5. Pingback: Name Generators Blog » Name randomizer

  6. Pingback: Blog name generator | Name Generators Blog

  7. Pingback: navnegenerator « Webdesign

  8. George says:

    Cool name generator script, mate. Exactly what I was looking for. Thanks.

  9. nicole says:

    This is great. Is there a way this can be modified to add on a input box so that it can give different types of names for say, males or females?

  10. Niels says:

    @nicole

    Yes of course. But do you mean a checkbox or maybe a radio buttun, so the user have to choose if he wants the generator to make a male or a female name?

  11. nicole says:

    Well first i need a select box to find out their gender, but i also need a text input box to collect their name cause i want to output fantasy names that are similar to their own name.

  12. Niels says:

    Well sorry if I make the wrong assumptions here, but when you ask I assume, that you are not too familiar with JavaScript.

    I think it will be hard to find a functional name generator script, that does exactly what you want, so you probably need to tweak anything you might find.

    But here’s a few tips:

    One easy way of solving the first issue, choosing sex, in a simple way is to duplicate the function in the generator script. Name the first function generator_male() and the other generator_female(). Make 2 buttons. One for male names and one for female names each of them calling the corresponding generator function.

    The other part is a little more tricky, if you new to programming. Getting the name from a input filed is easy enough though:

    document.getElementById("myInputfieldId").value

    It’s generating names that are similar to that name that’s a tad tricky. If you wanna use a traditional name generator script, you need to write a pattern/algorithm that’s exact describe what similarities you are testing for.

    As an alternative you can Change letters to make fantasy names. In this example I only change the vowels. But from the example it’s pretty easy to add new rules. For example change the first consonant, the last consonant and so on.

    Good luck. :)

  13. nicole says:

    Thankyou Niels. Well I found this script for a name generator and began trying to tweak it to my liking as you suggested. Anyhow to make a long story short it is not working now. The original code worked but it only had three categories of names, male names, female names and last names. I then added in some new arrays and some new selection boxes on the form, which is when I think I fudged it. The code is below. Not sure what I did wrong.

    var maleclone = new Array(
    “charlie”,”curly”,”cole”,
    )

    var femaleclone = new Array(
    “tanja”,”bella”,”morgan”
    )

    var malebothan = new Array(
    “teel”,”Ung”,”Jaster”
    )

    var femalebothan = new Array(
    “Traest”,”laryn”,”shila”
    )

    var bothanlastname = new Array(
    “fey’lya”,”sel’ab”,”saav’etu”
    )

    var clonelastname = new Array(
    “101″,”102″,”103″
    )
    var r = 0;
    var i = 0;

    function RandomName(nameform) {
    r = Math.floor(Math.random() * lastname.length);

    if((nameform.species.options[1].selected == true) && (nameform.gender.options[1].selected == true))
    {i = Math.floor(Math.random() * femalebothan.length);
    nameform.first.value=femalebothan[i]
    nameform.last.value=bothanlastname[r]
    }

    else if((nameform.species.options[1].selected == true) && (nameform.gender.options[2].selected == true))
    {i = Math.floor(Math.random() * malebothan.length);
    nameform.first.value=malebothan[i]
    nameform.last.value=bothanlastname[r]
    }

    else if((nameform.species.options[2].selected == true) && (nameform.gender.options[1].selected == true))
    {i = Math.floor(Math.random() * femaleclone.length);
    nameform.first.value=femaleclone[i]
    nameform.last.value=clonelastname[r]
    }

    else if((nameform.species.options[2].selected == true) && (nameform.gender.options[2].selected == true))
    {i = Math.floor(Math.random() * maleclone.length);
    nameform.first.value=maleclone[i]
    nameform.last.value=clonelastname[r]
    }
    }
    // End –>

  14. Niels says:

    Well, I can’t see any obvious mistakes in the code without actually running it, and I’m sorry but I really haven’t got the time to do that that, so you have to debug it yourself.

    Debugging is always hard work, but the harder the work the more rewarding it will also be when you get the code to work.

    Here’s a few basic tips to how to debug more efficiently.

    First of all use Firefox with a Firebug installed. It gives very valuable error messages.

    Then start all over with the basic name generator script that worked. And this time around add only one new feature at the time. If the new feature doesn’t work, use a lot of alert()’s placed all over the generator script. Alert all your variables to check, if they hold the values you expected. Alert lots of “test1″, “test2″, “test3″ to check how long you get in the code before it all crash, and to check if your conditional statements works as you expect.

    When one feature is working add the next one and so on.

    Good luck. :)

  15. Jessica says:

    Wait do we have to make it ourself? Or did you already make one that we can use instead of making one ourselves…

  16. Niels says:

    Hi Jessica. :)

    I already made a complete name generator script ready for download. But the name arrays are very short, so you have to replace my names with your own names in these arrays. It’s a bit like those cakes where you just need to add some water and then bake them yourself. ;)

    And just like the cakes, it’s actually pretty easy to do. Even if it’s the first time you try to program. Just download the generator script, and read this post and the “how to make a name generator”-post carefully. Everything you need to know is there.

    If you don’t wanna do anything yourself, but just want some cool names now just visit the name generators.

  17. Dino Dogan says:

    Hey Niels, I was wondering if this script can be integrated easily (or with great difficulty) into a php/mysql platform to randomly generate names for users who create an account.

    So for example, for every user that joins, I want to automatically create 3 guild names that are unique.

    Any insight is greatly appreciated :-)

  18. Niels says:

    Hi Dino.

    Interesting idea. If it’s easy or difficult… well it solely depend of your programming skills. ;)

    If I should make such a feature, I would transfer the name generator to php. It shouldn’t take more than 30 minutes. All the hard work lays in building the word arrays, the generator itself is very simple.

    The benefit of making it in php is that all you other functionality around the login and connections to the mySQL database is run in php scripts. It’s much easier to deal with database and the php, when all the funtionality lays on the server, instead of when the name generation takes place in the browser.

    I would do something like this:
    *When the users log ins for the first time, you run the name generator script
    *Compare the results with the guild names already in the MySQL database
    *Repeat name generation if necessary
    *Finally save the new and unique guild names in the database.

    It does take some work though to build such a flow. For the skilled programmer it’s probably pretty easy, for me it would take a little more time.

    Good luck, and when you get it up please come back and share. :)

  19. Dino Dogan says:

    @Niels
    Hi Niels, I really appreciate the time you’ve taken to answer this. I have none of the skills you refer to but I have a coding genius @dancristo next to me, so Im sure he can figure it out :-)

  20. Human says:

    As you can see from my “name” I can’t think of names very easily… I’m also a little slow on this, so I’m can’t get all this to work

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>