Welcome to WebmasterWorld Guest from 54.159.214.250

Forum Moderators: open

dropdown list changing content of textarea

how do i get index.php&color=blur to appear if a user selects blue

   
10:18 pm on Apr 5, 2006 (gmt 0)

10+ Year Member



I'm have a cms that lets users syndicate content using javascript. They can change the type of content they get based on what they put in the source URL. Something like this:

<script language="javascript" src="index.php?color=blue&shape=round"></script>

I'd like to help them construct this URL using javascript in a form. I keep thinking of Google Adsense as a good example. (The part where you can select the size and color of the ad)

Lets say the user has the option of specifying shape and color.

<form>

<select name="color">
<option value="">Select a Color</option>
<option value="color=blue">blue</option>
<option value="color=red">red</option>
</select>

<select name="shape">
<option value="">Select a Shape</option>
<option value="&shape=round">round</option>
<option value="&shape=square">square</option>
</select>

<textarea name="output">
<script language="javascript" src="index.php?**ADD FIELDS HERE**"></script>
</textarea>

</form>

It looks like I just need to add the select values onto the end of index.php? inside the text area.

As a further example, if they want content that is "round" and "blue" then I would need to provide the below in the text area.

<script language="javascript" src="index.php?color=blue&shape=round"></script>

I know very little about javascript but can't seem to even grasp this enough to search for examples.

Can anyone help me out here?

1:14 pm on Apr 10, 2006 (gmt 0)

5+ Year Member




<form>

<select name="color">
<option value="">Select a Color</option>
<option value="blue">blue</option>
<option value="red">red</option>
</select>

<select name="shape">
<option value="">Select a Shape</option>
<option value="round">round</option>
<option value="square">square</option>
</select>

<input type="submit">
</form>
That would be the best way to go, since you don't know javascript. then do all of your coding on the server side

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month