HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Iron Speed
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:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old April 29th, 2008, 09:44 AM
edmondj edmondj is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 61 edmondj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 51 m 21 sec
Reputation Power: 5
Question General - Question - Get value of SelectedIndex

How do I get the value of a SelectedIndex?

See below code

<script>
function toggleTextBox(){

var x = document.myform.hotOrderList.options;

if(x.[this.selectedIndex].value == 'Yes'){

document.myform.txtHotOrderName.style.display = '';
}
else{
document.myform.txtHotOrderName.style.display = 'none';
}
}
</script>

Regards,
Edmond

Reply With Quote
  #2  
Old April 29th, 2008, 09:50 AM
BLarche BLarche is offline
Contributing User
Click here for more information.
 
Join Date: Jan 2007
Location: Indianapolis, USA
Posts: 3,039 BLarche User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)BLarche User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)BLarche User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)BLarche User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)BLarche User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)BLarche User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)BLarche User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)BLarche User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)BLarche User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)BLarche User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)BLarche User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Month 3 Days 20 h 31 m 48 sec
Reputation Power: 469
This is not ASP, this is JavaScript.
__________________
"You'll never be as perfect as BLaaaaaaaaarche."

Reply With Quote
  #3  
Old April 30th, 2008, 04:59 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,397 Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)  Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 3 Days 22 h 32 m 47 sec
Reputation Power: 1311
this would work:
Code:
if (document.myform.hotOrderList.value == 'Yes') {

Reply With Quote
  #4  
Old May 13th, 2008, 02:58 PM
edmondj edmondj is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 61 edmondj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 51 m 21 sec
Reputation Power: 5
hi

i need to get the value of the dropdown list selectedIndex. With the below code, it gives me an error saying it needs an object. any insight on this problem will be awesome :-)

see below
<code>
<script type="javascript">
function toggle(){
if(document.myform.refreshList.options[document.myform.refreshList.options.selectedIndex].value == 'No'){
document.myform.refreshnum.style.display = '';
document.myform.refreshnote.style.display = '';
}
else{
document.myform.refreshnum.style.display = 'none';
document.myform.refreshnote.style.display = 'none';
}
}
</script>
</code>


Quote:
Originally Posted by Shadow Wizard
this would work:
Code:
if (document.myform.hotOrderList.value == 'Yes') {

Reply With Quote
  #5  
Old May 13th, 2008, 03:08 PM
ChiefWigs1982's Avatar
ChiefWigs1982 ChiefWigs1982 is offline
Cunning Linguist
ASP Free Loyal (3000 - 3499 posts)
 
Join Date: Mar 2005
Location: I used to live at home, now I stay at the house
Posts: 3,269 ChiefWigs1982 User rank is Captain (20000 - 30000 Reputation Level)ChiefWigs1982 User rank is Captain (20000 - 30000 Reputation Level)ChiefWigs1982 User rank is Captain (20000 - 30000 Reputation Level)ChiefWigs1982 User rank is Captain (20000 - 30000 Reputation Level)ChiefWigs1982 User rank is Captain (20000 - 30000 Reputation Level)ChiefWigs1982 User rank is Captain (20000 - 30000 Reputation Level)ChiefWigs1982 User rank is Captain (20000 - 30000 Reputation Level)ChiefWigs1982 User rank is Captain (20000 - 30000 Reputation Level)ChiefWigs1982 User rank is Captain (20000 - 30000 Reputation Level)  Folding Points: 50746 Folding Title: Beginner FolderFolding Points: 50746 Folding Title: Beginner FolderFolding Points: 50746 Folding Title: Beginner Folder
Time spent in forums: 1 Month 1 Week 2 Days 11 h 20 m 8 sec
Reputation Power: 228
Facebook
Code:
var s = document.myform.refreshList;
if(s.options[s.selectedIndex].value == 'No'){
__________________
Support requests via PM will be ignored!
Route of Queue | The General FAQ Thread | HOW TO POST A QUESTION

Sign up with Matched.co.uk and earn up to £15 per website every month!


Reply With Quote
  #6  
Old May 14th, 2008, 02:33 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,397 Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)  Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 3 Days 22 h 32 m 47 sec
Reputation Power: 1311
in order for this to work, you must have form named "myform" and this
form should have drop down element named "refreshList", case sensitive.
if you don't have any of those you will, indeed, get error.

Reply With Quote
  #7  
Old May 14th, 2008, 08:34 AM
edmondj edmondj is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 61 edmondj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 51 m 21 sec
Reputation Power: 5
Post the <option> tags as well, please.

Last edited by ChiefWigs1982 : May 14th, 2008 at 09:06 AM.

Reply With Quote
  #8  
Old May 14th, 2008, 09:07 AM
ChiefWigs1982's Avatar
ChiefWigs1982 ChiefWigs1982 is offline
Cunning Linguist
ASP Free Loyal (3000 - 3499 posts)
 
Join Date: Mar 2005
Location: I used to live at home, now I stay at the house
Posts: 3,269 ChiefWigs1982 User rank is Captain (20000 - 30000 Reputation Level)ChiefWigs1982 User rank is Captain (20000 - 30000 Reputation Level)ChiefWigs1982 User rank is Captain (20000 - 30000 Reputation Level)ChiefWigs1982 User rank is Captain (20000 - 30000 Reputation Level)ChiefWigs1982 User rank is Captain (20000 - 30000 Reputation Level)ChiefWigs1982 User rank is Captain (20000 - 30000 Reputation Level)ChiefWigs1982 User rank is Captain (20000 - 30000 Reputation Level)ChiefWigs1982 User rank is Captain (20000 - 30000 Reputation Level)ChiefWigs1982 User rank is Captain (20000 - 30000 Reputation Level)  Folding Points: 50746 Folding Title: Beginner FolderFolding Points: 50746 Folding Title: Beginner FolderFolding Points: 50746 Folding Title: Beginner Folder
Time spent in forums: 1 Month 1 Week 2 Days 11 h 20 m 8 sec
Reputation Power: 228
Facebook
Ah crap, sorry, I edited your post rather than posting a new one.

Can you respost your code, including the <option> tags?

Sorry dude!

Reply With Quote
  #9  
Old May 14th, 2008, 09:21 AM
edmondj edmondj is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 61 edmondj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 51 m 21 sec
Reputation Power: 5
hey.. it's ok
here is the code - see below

the dropdown list is reading from db
it doesn't have to be..

Code:
<body onload="toggle();">

<form name="myform">

<script>
function toggle(){
	var s = document.myform.refreshList;
	
	if(s.options[s.selectedIndex].value  == 'No'){
	document.myform.refreshnum.style.display = '';
		document.myform.refreshnote.style.display = '';
	}
	else{ 
	document.myform.refreshnum.style.display = 'none';
		document.myform.refreshnote.style.display = 'none';
	}
}
</script>

<select size="1" name="refreshList" onChange="toggle();" tabindex="3">
<option selected></option>
	
<%  
If refreshList <> "" Then
   Response.Write "<option selected>" & refreshList & "</option>"
End If
	
sql = "Select refresh From refresh Order By id"
set conn = Server.CreateObject("ADODB.Connection")
conn.open "provider=sqloledb;data Source=server;initial catalog=dashboard;integrated security=SSPI;"            
set rs = conn.execute(sql)
	            
do while not rs.eof
thisfield = trim(rs(0))
      	if isnull(thisfield) or thisfield="" then
	'                 
      	else
    		response.write "<option>" & thisfield & "</option>"
       	end if
             rs.movenext
loop
	%>		
</select>


Quote:
Originally Posted by ChiefWigs1982
Ah crap, sorry, I edited your post rather than posting a new one.

Can you respost your code, including the <option> tags?

Sorry dude!

Reply With Quote
  #10  
Old May 14th, 2008, 10:29 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,397 Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)  Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 3 Days 22 h 32 m 47 sec
Reputation Power: 1311
you get error because your form does not contain element
named "refreshnum". add such element and try again.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > General - Question - Get value of SelectedIndex


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!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

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