Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have the following script , I need to run alert each time a language is selected from the dropdown menu , I was able to alert it when spanish is selecte (value: es) , but I was not able to run the other languages alerts by adding the same scripts , only spanish will alert-


Here is the script:

<asp:DropDownList ID="aicLanguage" onchange="dropDownListOnChange(this);" runat="server" name="aicLanguage" Enabled="True">
<asp:ListItem Value="sl" Text="Select Language">
<asp:ListItem Value="en" Text="English">
<asp:ListItem Value="mn" Text="Chinese">
<asp:ListItem Value="ja" Text="Japanese">
<asp:ListItem Value="pt" Text="Portuguese">
<asp:ListItem Value="es" Text="Spanish">
<asp:ListItem Value="de" Text="German">





<script type='text/javascript'>

var dropdown = document.getElementById("aicLanguage");
dropdown.onchange = function (event) {
if (dropdown.value == "es") {
alert(" SPANISH SCHEDULE")

}
}


</script>
Posted

1 solution

Use "else if"

http://www.w3schools.com/js/js_if_else.asp[^]

Also please take time to at least learn the basics of coding. It's a waste of your time and ours to ask such basic questions as this, a decent understanding of the language in general is a bare minimum before you start trying to write actual code. Asking about every little question is not an efficient way to learn.
 
Share this answer
 
Comments
Member 11869395 28-Jul-15 13:16pm    
Sorry.... I´m learning and I already try else if.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900