Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finding the current item# in drop down list
Message
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires Web
Titre:
Finding the current item# in drop down list
Divers
Thread ID:
00928014
Message ID:
00928014
Vues:
53
I forget who, but someone gave me a piece of JavaScript to get the data from a TextBox on a web page. I modified it to get information from a ListBox and a DropDownList.

I need one more piece of information to get it to do what I currently need.
I need to know which item is the currently selected item of my DropDownList.

As an example,
My DropDownList has three items in it...
ddlMyList[0] = "Low"
ddlMyList[1] = "Medium"
ddlMyList[2] = "High"

My page is displaying "Medium" in the DDL
How do I tell my JavaScript that it's item 1 ... the second item?
What I need to know is What do I set "ddlPriorityItemNumber" to...
and
How do I set it?

For reference, here's my JavaScript
function SetAlarm()
{
	var myAlarmTime;
	var myAlarmMessage;
	var ddlPriorityItemNumber;
	
	ddlPriorityItemNumber = 0;
	
	myAlarmTime = GetReminderTimeTextBoxValue();
	
	myAlarmMessage = "";
	myAlarmMessage = "Priority: " + GetddlPriorityMessage(ddlPriorityItemNumber) + "\n";
	
	top.FrameHeaderStatic.SetMyAlarm(myAlarmTime, myAlarmMessage);
}


function GetReminderTimeTextBoxValue()
{
	var oTextBox = document.getElementById("txtReminderMaintenanceActivityAlarm_Status")
	return oTextBox.value
}
			
function GetddlPriorityMessage(MyItem)
{
	var oListBox = document.getElementById("ddlReminderMaintenanceActivityPriority")
	return oListBox.options[MyItem].text
}
			
TIA,
Rick
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform