Q:

call javascript function on asp dropdown list change

        <script type="text/javascript">
            function ddl(id) {
      //          var id = document.getElementById('<%=DDLquestionType.ClientID%>').value;
                if (id == "Open") {
                    AmericanAnswer.style.display = 'none';
                    document.getElementById('Answer1_Btn').style.visibility = false;
                    
                }
                alert(id);
            }
        </script>
                <asp:DropDownList ID="DDLquestionType" CssClass="ddlQuestionType box"  runat="server" AutoPostBack="True" onchange="ddl(this)" >
                    <asp:ListItem Text="American" Value="American"></asp:ListItem>
                    <asp:ListItem Text="Open" Value="Open"></asp:ListItem>
                    <asp:ListItem Text="Yes/No" Value="YesNo"></asp:ListItem>
                    <asp:ListItem Text="Numerical" Value="Numerical"></asp:ListItem>
                </asp:DropDownList>

I have this java script function:
Which I try to call on drop down list selection change
It doesn't work. 
I also tried
    onchange="javascript:ddl()" and function without parameters, 
    ononchange="javascript:ddl(this);", 
    ononchange="javascript:ddl(this.value);", 
and many others.
I'm new to java script, any links with explanations also will be highly appreciated

A:

you dosent need to pass this parameter or id, you just call the function and onchange() event call the function.
in javascript use id of your dropdown list to get the value of dropdown list.

<script type="text/javascript">
function processchange(value)
{
  if(ddl.value=="American")
    // your code
}
</script>

<dropdownlist id="ddl" onchange="processchange()" >
  //enter your dropdown items
  
  </dropdownlist>

