13, February 2012

drop down menu form question - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Design and Layout  >  Web Page Design (Moderator: Meth0d)
Topic: drop down menu form question
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: drop down menu form question  (Read 1450 times)
OMG!I am geek
**
Posts: 53
406 credits
Members referred : 0


« on: Apr 20, 2008, 07:44:56 pm »

I'm not sure what its called, but looking for information on how to go about making it so that while in a form if there will be a drop down menu and depending on what you select more form objects will appear that are assoicated with that selection.

i hope that made sense 
OMG!I am geek
**
Posts: 53
406 credits
Members referred : 0


« Reply #1 on: Apr 21, 2008, 12:27:35 am »

well i did find what i was looking, just took a lot of searching since didnt know what it was called.

however this is one thing in this that i am having a problem with. i need to create a two levels of drop downs. but when i try to do that it dosn't seem to work. here is the code, what i am i missing?

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script type="text/javascript">
function showInfo()
{
var elem = document.getElementById('verify');
if(document.forms[0].menu.value == "verify")
{
elem.style.display="inline";
}
else
{
elem.style.display="none";
}
var elem = document.getElementById('second');
if(document.forms[0].menu.value == "second")
{
elem.style.display="";
}
else
{
elem.style.display="none";
}
var elem = document.getElementById('list');
if(document.forms[0].menu.value == "list")
{
elem.style.display="";
}
else
{
elem.style.display="none";
}
}
</script>
</head>

<body>
<form action="#" >
<select name="menu" onchange="showInfo()">
<option value="none">Select an option</option>
<option value="email">Email</option>
<option value="second">second</option>
</select>

<div id="verify" style="display:none;">
<input type="text" value="Username" onfocus="if(this.value == 'Username'){this.value=''}">
<input type="password" value="password" onfocus="if(this.value == 'password'){this.value=''}">
</div>

<div id="second" style="display:none;">
<select name="menu2" onchange="showInfo()">
<option value="none">Select an option</option>
<option value="list">list</option>
</select>
</div>

<div id="list" style="display:none;">
<input type="text" value="list">
</div>
</form>
</body>
</html>
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5778
46265 credits
Members referred : 3



« Reply #2 on: Apr 23, 2008, 09:33:24 am »

This code looks ok to me. Which part is not working? (I can't test it right now to see it in action)

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
OMG!I am geek
**
Posts: 53
406 credits
Members referred : 0


« Reply #3 on: Apr 23, 2008, 11:10:22 pm »

i found my problem to this just a few mins ago,

i needed to change
Code:
if(document.forms[0].menu.value == "list")
to
Code:
if(document.forms[0].menu2.value == "list")

what was happening was after the second level drop down menu section it wouldn't display the options for the third level of it.

also is there a better way of doing this?
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=7702
Tags : html drop menu Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Design and Layout  >  Web Page Design (Moderator: Meth0d)
Topic: drop down menu form question
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Feb 13, 2012, 05:34:15 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.