HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 24th, 2009, 10:42 PM
naresbiz1 naresbiz1 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 1 naresbiz1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 m 14 sec
Reputation Power: 0
Unhappy JavaScript - DIV enable disable using DropDown onchange

I have a dropdown having four menu list under that there are four div tags when dropdown onchange it should enable one div tag and disable other three like that for every change one should enable remaining all should should Disable with out displaying in page...........please any body can help......?

Reply With Quote
  #2  
Old November 4th, 2009, 03:24 AM
phoenix1986's Avatar
phoenix1986 phoenix1986 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2009
Location: India
Posts: 316 phoenix1986 User rank is Second Lieutenant (5000 - 10000 Reputation Level)phoenix1986 User rank is Second Lieutenant (5000 - 10000 Reputation Level)phoenix1986 User rank is Second Lieutenant (5000 - 10000 Reputation Level)phoenix1986 User rank is Second Lieutenant (5000 - 10000 Reputation Level)phoenix1986 User rank is Second Lieutenant (5000 - 10000 Reputation Level)phoenix1986 User rank is Second Lieutenant (5000 - 10000 Reputation Level)phoenix1986 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 4 Days 23 h 41 m 46 sec
Reputation Power: 75
Send a message via Yahoo to phoenix1986
Quote:
should Disable with out displaying in page.


you want to enable/disable them or hide/unhide them ?
__________________
“Life may not be the party we hoped for, but while we are here we should sing, dance and be merry all the time......."

Reply With Quote
  #3  
Old November 4th, 2009, 04:53 AM
sync_or_swim's Avatar
sync_or_swim sync_or_swim is offline
Moderator
Click here for more information.
 
Join Date: Mar 2006
Location: South Wales
Posts: 3,461 sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level)sync_or_swim User rank is General 12nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 2 Months 1 Day 16 h 50 m 26 sec
Reputation Power: 1806
Quote:
Originally Posted by naresbiz1
I have a dropdown having four menu list under that there are four div tags when dropdown onchange it should enable one div tag and disable other three like that for every change one should enable remaining all should should Disable with out displaying in page...........please any body can help......?

As Aashish says, did you want to enable/disable the divs or hide/show them?

Heres a simple example that hides the ones that aren't selected:
Code:
<script>
var browserType;

if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {
 browserType= "gecko"
}

function hide(whichelement) {
  if (browserType == "gecko" )
     document.poppedLayer =
         eval('document.getElementById(whichelement)');
  else if (browserType == "ie")
     document.poppedLayer =
        eval('document.getElementById(whichelement)');
  else
     document.poppedLayer =
        eval('document.layers[whichelement]');
  document.poppedLayer.style.display = "none";
}

function show(whichelement) {
  if (browserType == "gecko" )
     document.poppedLayer =
         eval('document.getElementById(whichelement)');
  else if (browserType == "ie")
     document.poppedLayer =
        eval('document.getElementById(whichelement)');
  else
     document.poppedLayer =
         eval('document.layers[whichelement]');
  document.poppedLayer.style.display = "inline";
}

function doHideShow(theDiv){
	for(var a=1;a<=4;a++){
		if(a==theDiv){
			show("div"+a);
		}else{
			hide("div"+a);
		}
	}
}
</script>
<html>
<head>
    <title></title>
</head>
<body>
    <form name="form1">
		<select name="showhide" onchange="doHideShow(document.form1.showhide.selectedIndex+1  );">
			<option value="1">Div 1</option>
			<option value="2">Div 2</option>
			<option value="3">Div 3</option>
			<option value="4">Div 4</option>
		</select>
		<br>
		<div id="div1" style="display: inline; border-width: 1px; border-style: none;">
			<layer></layer>
			This is Div 1
		</div>
		<br>
		<div id="div2" style="display: none; border-width: 1px; border-style: none;">
			<layer></layer>
			This is Div 2
		</div>
		<br>
		<div id="div3" style="display: none; border-width: 1px; border-style: none;">
			<layer></layer>
			This is Div 3
		</div>
		<br>
		<div id="div4" style="display: none; border-width: 1px; border-style: none;">
			<layer></layer>
			This is Div 4
		</div>
    </form>
</body>
</html>

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > JavaScript - DIV enable disable using DropDown onchange


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek