Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Using a "dropdown" <select> to show/hide hidden layers
Old 03-04-2007, 09:46 PM Using a "dropdown" <select> to show/hide hidden layers
Average Talker

Posts: 27
Location: CT
Trades: 0
I have an application form on my site that requires users to insert information, to apply for credit.

I am trying to make a script that shows a hidden layer, named "Previous" if the user selects "01" or "0" from a select box nammed "ap_add5". Which basically means that if the person filling out the form has lived at their current address for less than 2 years a layer showing "Previous Address" fields will appear.

Can anyone help with this?
DBookatay is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-05-2007, 01:41 PM Re: Using a "dropdown" <select> to show/hide hidden layers
pitbull82's Avatar
Super Talker

Posts: 147
Name: Marcin Nabiałek
Location: Poland, Częstochowa
Trades: 0
There you go:

Code:
<html>
<head>
</head>
<style>
div#Previous
{
	display: none;
	border: 1px solid red;
}

</style>

<script type="text/javascript">
function check()
{
	var select=document.getElementById('ap_add5');
	value=select.options[select.selectedIndex].value;
	
	if (value == '1' || value=='0')
		document.getElementById('Previous').style.display='block';
	else
		document.getElementById('Previous').style.display='none';
}

</script>
<body>



<select id="ap_add5" name="ap_add5" onchange="check();">
	<option value="">Choose</option>
	<option value="0">0</option>
	<option value="1">1</option>
	<option value="2">2</option>
</select>

<div id="Previous">
	Previous Text
</div>
</body>
</html>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
pitbull82 is offline
Reply With Quote
View Public Profile Visit pitbull82's homepage!
 
Reply     « Reply to Using a "dropdown" <select> to show/hide hidden layers
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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





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



Page generated in 0.09697 seconds with 12 queries