Reply
Show/Hide Div's using Drop-Down Menu Form
Old 10-04-2006, 12:20 AM Show/Hide Div's using Drop-Down Menu Form
Junior Talker

Posts: 3
Name: Rhys
Hi There,

Does anybody know how to make collapsible tables (Show/Hide div's) with a HTML Drop-Down Menu Form?

Ive been looking everywhere but with no luck at all. Most of the info i find is for dhtml menus but i need this to work using a standard html form Drop-Menu.

Any help or location of a script would be much helpful.

Cheers.
RhysG is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 10-04-2006, 12:34 AM Re: Show/Hide Div's using Drop-Down Menu Form
funkdaddu's Avatar
Web Design Snob

Posts: 636
By "HTML Drop-Down Menu Form" do you mean a select box Like this:

Code:
<select name="asd">
<option value="one">1</option>
<option value="two">2</option>
</select>
__________________
Will Work For Talkputation...
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 10-04-2006, 01:30 AM Re: Show/Hide Div's using Drop-Down Menu Form
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
<select name="formField" onchange="Javascript function to show or hide divs here">

That would do it.
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 10-04-2006, 02:21 AM Re: Show/Hide Div's using Drop-Down Menu Form
Junior Talker

Posts: 3
Name: Rhys
Thanks for your quick help... Youv'e put me in the right direction, but do you know of a good script or even a tutorial that can help me get this working right im learning and this will be great way to know in future.
RhysG is offline
Reply With Quote
View Public Profile
 
Old 10-04-2006, 09:47 AM Re: Show/Hide Div's using Drop-Down Menu Form
funkdaddu's Avatar
Web Design Snob

Posts: 636
Something like this?:
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">

<html>

	<head>
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<title>Untitled Page</title>
		<script type="text/javascript"><!--
var lastDiv = "";
function showDiv(divName) {
	// hide last div
	if (lastDiv) {
		document.getElementById(lastDiv).className = "hiddenDiv";
	}
	//if value of the box is not nothing and an object with that name exists, then change the class
	if (divName && document.getElementById(divName)) {
		document.getElementById(divName).className = "visibleDiv";
		lastDiv = divName;
	}
}
//-->
</script>
		<style type="text/css" media="screen"><!--
.hiddenDiv {
	display: none;
	}
.visibleDiv {
	display: block;
	border: 1px grey solid;
	}

--></style>
	</head>

	<body bgcolor="#ffffff">
		<form id="FormName" action="blah.php" method="get" name="FormName">
			<select name="selectName" size="1" onchange="showDiv(this.value);">
				<option value="">Choose One...</option>
				<option value="one">first</option>
				<option value="two">second</option>
				<option value="three">third</option>
			</select>
		</form>
		<p id="one" class="hiddenDiv">This is paragraph 1.</p>
		<p id="two" class="hiddenDiv">This is paragraph 2.</p>
		<p id="three" class="hiddenDiv">This is paragraph 3.</p>		
	</body>

</html>
__________________
Will Work For Talkputation...
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 10-17-2006, 01:56 AM Re: Show/Hide Div's using Drop-Down Menu Form
seomumbai's Avatar
Skilled Talker

Posts: 98
When you select a item in a dropdown menu list then you can hide the tables by using If condition's.
seomumbai is offline
Reply With Quote
View Public Profile
 
Old 10-18-2006, 12:48 AM Re: Show/Hide Div's using Drop-Down Menu Form
Experienced Talker

Posts: 36
Name: Brian Collins
I did it with this script
http://javascript.internet.com/css/page-organizer.html

I just put the info in the links into a java drop down menu so instead of clicking the link you select it from the drop down
bmcoll3278 is offline
Reply With Quote
View Public Profile
 
Old 10-19-2006, 02:50 AM Re: Show/Hide Div's using Drop-Down Menu Form
seomumbai's Avatar
Skilled Talker

Posts: 98
I think you can use If Else conditions in html also in ASP.NET.
seomumbai is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Show/Hide Div's using Drop-Down Menu Form
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14091 seconds with 12 queries