re:urgent help...asp & javascript on firefox

asp , java United States
  • 16 years ago
    I have been trying for more than 2 days to resolve a problem in asp where i hav 2 combo box and both combo i load the data from database.
    When i choose the 1st combo, the 2nd combo will response to the value that i choose from 1st combo. in this case, i use javascript.
    My code is like the below:-
    HTML part:
    <td style="width:35%">
    <select style="width:100%" name="txtDesignationID" onchange="txtDesignationID_onchange(GetIndex(event.srcElement))">
    <option value="">Select Designation First</option>
    <%if TeamRS.RecordCount > 0 then TeamRS.MoveFirst
    do while not TeamRS.EOF%>
    <option value="<%=TeamRS("Code_Name")%>"><%Response.Write TeamRS("Code_Name")%></option>
    <%TeamRS.MoveNext
    loop%>

    Javascript part:
    function txtDesignationID_OnChange()
    {
           try{
       el = event.srcElement;
       
       if (document.frmasp.txtDesignationID.length > 1)
       {
           for (var c=0;c<document.frmasp.txtDesignationID.length;c++) {
               if (el == document.frmasp.txtDesignationID[c]) {
                   var Tmp = document.frmasp.txtDesignationID[c].options[document.frmasp.txtDesignationID[c].selectedIndex].value;
                   if (Tmp != "") {
                       clear_txtAllocatedStaffID(c);
                       var url = "select_person.asp?txtDesignationID=" + Tmp + "&selected="+c;
                       window.open(url,'','toolbar=no location=no directories=no status=no menubar=no scrollbars=yes resizable=yes width=1 height=1 top=1 left=1');
                   }
               }
           }
       }
       } catch (e) {
           alert(e);
       }
    }
    </select></td>

    This coding work well in IE, how ever when i run it at Firefox (coz i use Machintos) it cannot work. The error it return to me is Javascript Type Error: Event has no properties.

    Do anyone have any solution?? or got any other way to get the combo box index.

    Thanks and appreciate.

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” - Tom Cargill