PDA

View Full Version : Javascript dropdown text



easybake
November 5th, 2009, 09:18 PM
Ok, first off I would like to say that my javascript knowledge is minimal at best but I am trying to learn. Here is my problem:

I am running a dropdown menu with options like this

<select name="menu" style="font-family:'Arial';color:#0066CC;background-color:#FFFFFF;font-size:10pt;">
<option value="">Choose One-</option>
<option value="Guarantee.tpl">Our Guarantee</option>
<option value="green.tpl">Green</option>
<option value="Packaging.tpl>Packaging</option>
<option value="card.tpl">Gift Cards</option>
</select>
<input type="button" onClick???????? value="GO!">
</form>

What I want to do is have the template files load below where the dropdown menu is. This way, I can have a single page that contains only the content selected by the drop down menu.

The problem I am having is the things I have found only have the content load in a new page/tab. Any ideas on how I could do this.

The .tpl files are html templates which are used with
{include file="template.tpl"}

korvirlol
November 5th, 2009, 11:29 PM
if you are using a scripting language like php, you can do something like;


$selectoptions = file_get_contents(/path/to/your/tpl/file.tpl);

and in the html:


<select>
<option></option>
<?php print $selectoptions; ?>
</select>