PDA

View Full Version : Need litle help in about form element



sakib000
02-22-2008, 08:42 PM
I am newbie to html forms elements. can someone please tell me how do I make <select /> option in a way when a user select product A, another question related to this product appears.

please see this form (https://www.ixwebhosting.com/index.php/v2/signup.dspFrmSignup/init/1/signup_type/design). When you select a product, another section related to this product appear

thanks

Jas
02-23-2008, 02:58 AM
Like this script (http://www.dynamicdrive.com/dynamicindex16/chainedselects/index.htm)? Dynamic Drive offers a lot of great scripts, including form effects. Check them out :)

rangana
02-23-2008, 03:05 AM
..or like this

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function change()
{
switch (document.getElementById("select").value)
{
case "1":
document.getElementById("change").innerHTML = "Option 1 has changed this DIV tag's content"
break;
case "2":
document.getElementById("change").innerHTML = "<font color='#ff0000'>Option 2 has changed this DIV tag's content</font>"
break;
case "3":
document.getElementById("change").innerHTML = "<font color='#0000ff'>Option 3 has changed this DIV tag's content"
break;
}
}
</script>
</head>
<body>
<select onchange="change()" id="select">
<option value="">Feel Free to choose</option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
<div id="change" style="display:inline;margin:10px;border:1px solid #999;">
Original Text
</div>
</body>
</html> :D

sakib000
02-23-2008, 12:46 PM
thanks to both, rangana did exactly. thanks again

rangana
02-24-2008, 09:38 AM
NO problem...you're welcome.:D

sakib000
02-25-2008, 08:14 PM
rangana,
how can i put any html inside
.innerHTML = "here"

I am trying to put
<select id="extrapages" class="dropdown" name="additionalsilver">
<option>1 +$65.95</option>
<option>2 +$131.90</option>
<option>3 +$197.40</option>
<option>4 +$263.35</option>
</select>

and its not working

thetestingsite
02-25-2008, 11:03 PM
document.getElementById("change").innerHTML = "<select id='extrapages' class='dropdown' name='additionalsilver'>";
document.getElementById("change").innerHTML += "<option>1 +$65.95</option>";
document.getElementById("change").innerHTML += "<option>2 +$131.90</option>";
document.getElementById("change").innerHTML += "<option>3 +$197.40</option>";
document.getElementById("change").innerHTML += "<option>4 +$263.35</option>";
document.getElementById("change").innerHTML += "</select>";


Hope this helps.

sakib000
02-26-2008, 11:51 AM
and its not working ^

boogyman
02-26-2008, 02:06 PM
change




document.getElementById("change").innerHTML = "<select id='extrapages' class="dropdown" name='additionalsilver'>";



to


document.getElementById("change").innerHTML = "<select id='extrapages' class='dropdown' name='additionalsilver'>";

he had an extra set of double quotes, thus ending the string pre-maturely

thetestingsite
02-27-2008, 01:42 AM
change to


document.getElementById("change").innerHTML = "<select id='extrapages' class='dropdown' name='additionalsilver'>";

he had an extra set of double quotes, thus ending the string pre-maturely

Oops, missed that one. Thanks for noticing.