homepage Welcome to WebmasterWorld Guest from 54.237.54.83
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
dropdown list changing content of textarea
how do i get index.php&color=blur to appear if a user selects blue
mrowton




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

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?

 

phillipandrews




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


<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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved