5, September 2008

drop down menu form question - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ 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

Author Topic: drop down menu form question  (Read 330 times)
Cyberpunk Wannabe
*
Posts: 46
352 credits
Members referred : 0


« on: Apr 20, 2008, 08: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 
Cyberpunk Wannabe
*
Posts: 46
352 credits
Members referred : 0


« Reply #1 on: Apr 21, 2008, 01: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: 8037
41179 credits
Members referred : 3



« Reply #2 on: Apr 23, 2008, 10: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 Visit through proxy

Last blog : MIA - Where Nick and Tim
Cyberpunk Wannabe
*
Posts: 46
352 credits
Members referred : 0


« Reply #3 on: Apr 24, 2008, 12:10:22 AM »

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....

Topic sponsors:
Get a permanent link here for $1.99!


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?
Sep 05, 2008, 04:48:45 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!


Forum Statistics
Total Posts: 36.293
Total Topics: 7.476
Total Members: 3.899
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: speedy5044

34 Guests, 5 Users online :

16 users online today:



Readers

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