View Full Version : How to change a form based on select option?

05-25-2009, 06:18 PM
Hi, I don't know if this is something you could do without JavaScript, but anyways...
I want to make a drop down menu that changes a form based on the option, like if I chose Option1, it would show Form1 and so on.

And also, if anyone knows how to list items in a div, that would be helpful too.


Philip M
05-25-2009, 06:46 PM
Try this:-

<select id = "opts" onchange = "showForm()">
<option value = "0">Select Option</option>
<option value = "1">Option 1</option>
<option value = "2">Option 2</option>

<div id = "f1" style="display:none">
<form name= "form1">
Content of Form 1

<div id = "f2" style="display:none">
<form name= "form2">
Content of Form 2

<script type = "text/javascript">
function showForm(){
var selopt = document.getElementById("opts").value;
if (selopt == 1) {
if (selopt == 2) {


"The reward for conformity was that everyone liked you except yourself". - Rita Mae Brown.

05-25-2009, 06:55 PM
Thanks, that's just what I needed :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum