View Full Version : Generating a word or phrase based on drop-down menu ...?

12-16-2005, 11:59 PM

I've got a question... Does anyone here know/can find the code for generating a word (probably in a text area) based on what has been selected from a drop-down menu or radio buttons?

An example would be here: http://www.neonuttersofneopia.com/petposer.php

Except that generates images. I wonder if anyone could edit the coding to have it show a word depending on what's selected in the menus. Thanks.


12-17-2005, 12:56 AM
<div id="updated_text">
Default text here.
<form name="selection_form">
<select name="selection" onchange="update()">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>


function update() {
document.getElementById("updated_text").innerHTML = "You changed the value to " + document.selection_form.selection.value + ".";


If you plop that into an HTML file, and open it in your browser, you'd see that it does exactly what you want. =)

12-17-2005, 01:15 AM
Osiris -- thanks a TON. :D Now. I'm sorry for being so picky, and although I MIGHT be able to figure this out on my own (though it'd take days), I just have one small request...?

I am trying to use this Javascript thing to generate specific kinds of words. Like, I want the word that appears to depend on these things:

~ Number of words, which I'm thinking could be selected out of radio buttons (or just regular buttons), which then generates a specific drop down list containing:
~ First letter of each word/phrase, which would use the code you gave me.

Seriously, I can probably figure this out on my own. But not very quickly. Again, though, thanks SO MUCH because if I must find out how to do this on my own, then this gets me a super head start. You rock :thumbsup:


PS. Here is what I am trying to work on: http://www.freewebs.com/isketch-cs/animalseasytest.htm - I could still explain it if anyone needs an explanation

12-17-2005, 02:43 AM
I'm not quite sure I understand what you're asking... Could you try to be just a little more specific?