By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,254 Members | 1,713 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,254 IT Pros & Developers. It's quick & easy.

asp code working in firefox and ie7 but not working in ie6

P: 2
i just write code for select option in combo box which i m select but when i press search button and then click on back button then there in no option selected. and that same code working in ie7 and firefox so plz any 1 suggest me soluction quickly..
Nov 28 '07 #1
Share this Question
Share on Google+
3 Replies


acoder
Expert Mod 15k+
P: 16,027
Can you post your code please.
Nov 28 '07 #2

P: 2
Can you post your code please.
Expand|Select|Wrap|Line Numbers
  1. <%
  2. set dataConnection = Server.CreateObject("ADODB.Connection")
  3. dataConnection.Open MAIN_DSN
  4.  
  5. sqlQuery =  "EXEC sp_getCategories NULL"
  6. set categoriesRS = dataConnection.Execute(sqlQuery)
  7.  
  8. if (not(categoriesRS.BOF and categoriesRS.EOF)) then   
  9.    arrCategoriesDB = categoriesRS.GetRows()
  10.  
  11.    arrcount = 0
  12.    for each fieldValue in categoriesRS.fields
  13.       fieldName = fieldValue.Name
  14.       Execute("fld_" & fieldName & " = arrcount")
  15.       arrcount = arrcount + 1
  16.    next
  17.  
  18.    numCategoriesRows=ubound(arrCategoriesDB,2)
  19. end if
  20.  
  21. set categoriesRS = nothing
  22.  
  23. firstCat1 = ""
  24. if (thisCategoryID <> "") then
  25.    sqlQuery =  "EXEC sp_getCategories " & thisCategoryID
  26.    set pathRS = dataConnection.Execute(sqlQuery)
  27.  
  28.    index=0
  29.    for x=1 to 4
  30.       if (pathRS("CategoryID" & x) <> 0) then
  31.          index = index + 1
  32.          Execute("firstCat" & index & " = pathRS(""CategoryID" & x & """)")
  33.       end if
  34.    next
  35.  
  36.    set pathRS = nothing
  37. end if
  38.  
  39. ' Function to create the a list of code for dynamic drop down javascript
  40. function javaArray()
  41.  
  42.    prevCat = ""
  43.    for rowcounter = 0 to numCategoriesRows
  44.       if (arrCategoriesDB(fld_CategoryID3,rowcounter) <> prevCat) then
  45.          prevCat = arrCategoriesDB(fld_CategoryID3,rowcounter)
  46.          strQuery = strQuery & "arrCat[" & prevCat & "] = """
  47.  
  48.          for rowcounter2 = 0 to numCategoriesRows
  49.             if (arrCategoriesDB(fld_CategoryID3,rowcounter2) = prevCat) then
  50.                strQuery = strQuery & arrCategoriesDB(fld_CategoryName4,rowcounter2) & "#" & arrCategoriesDB(fld_CategoryID4,rowcounter2) & "||"
  51.             end if
  52.          next
  53.  
  54.          strQuery = strQuery & """;"
  55.       end if
  56.    next
  57.  
  58.    javaArray = strQuery 
  59. end function
  60.  
  61. %>
  62. <script language="javascript">   
  63.    var arrCat = new Array();
  64. <%= javaArray() %>
Expand|Select|Wrap|Line Numbers
  1. function mmChangeContact(objFldParent,objFldChild, contact_caption)
  2. {
  3.    var ContactList = arrCat[<%= firstCat1 %>];
  4.    clearList(objFldChild);
  5.    addElement(objFldChild, contact_caption, "");
  6.  
  7.    if(ContactList)
  8.    {
  9.  
  10.       var rgContacts = ContactList.split('||');
  11.  
  12.             addElement(objFldChild, "Select All", "ALL");
  13.       for (var i = 0; i < rgContacts.length; i++)
  14.       {
  15.          if (rgContacts[i])
  16.          {
  17.             var rgContact = rgContacts[i].split('#');
  18.                         addElement(objFldChild, rgContact[0], rgContact[1]);
  19.          }
  20.       }
  21.  
  22.       objFldChild.disabled = false;
  23.    } 
  24.      else 
  25.      {
  26.       objFldChild.disabled = true;
  27.    }
  28.  
  29.      //objFldChild.selectedIndex = 0;
  30.  
  31.  
  32. function clearList(list) 
  33. {
  34.    var i = 0;
  35.    var o = list.options;
  36.  
  37.    for (i = o.length; i >= 0; --i)
  38.       o[i] = null;
  39.    list.disabled = true;
  40. }
  41.  
  42. function addElement(list, text_in, value_in)
  43. {
  44.    var o = list.options;
  45.    var nIdx;
  46.  
  47.    if (o.length < 0) //IE for Mac 4.5 sets length to -1 if list is empty
  48.       nIdx = 0;
  49.    else
  50.  
  51.    nIdx = o.length;
  52.  
  53.    o[nIdx] = new Option(text_in, value_in);
  54.    list.disabled = false;
  55. }
  56.  
  57. function setDefaultByText(list, text_in)
  58. {
  59.    with (list)
  60.    {
  61.       for (var i = 0; i < (options.length); i++)
  62.       {
  63.          if (options[i].text == text_in)
  64.          {
  65.             selectedIndex = i;
  66.             return;
  67.          }
  68.        }
  69.    }
  70. }
  71.  
  72. function setDefaultByValue(list, value_in)
  73. {
  74.    with (list)
  75.    {
  76.       for (var i = 0; i < (options.length); i++)
  77.       {
  78.          if (options[i].value == value_in)
  79.          {
  80.             selectedIndex = i;
  81.             return;
  82.          }
  83.       }
  84.    }
  85. }
  86.  
  87. function validate(){
  88.    var objFld = document.EDITPRODUCT
  89.    var flagAffiliate = 0
  90.  
  91.     if (objFld.Parent1.value != "") 
  92.     {
  93.         objFld.CategoryID.value = objFld.Parent1.value
  94.         flagAffiliate = 1
  95.     }
  96.  
  97.     if (objFld.Parent1.value == "")
  98.     {
  99.         alert("Please Select a Make");
  100.         return false; 
  101.     }
  102.     /*if (objFld.Child.value == "")
  103.     {
  104.         alert("Please Choose a Vehicle Model");
  105.         return false; 
  106.     }
  107.     if (objFld.GrandChild.value == "")
  108.     {
  109.         alert("Please Choose a Vehicle Model");
  110.         return false; 
  111.     }*/
  112.  
  113.     return true;
  114. }
  115. </script>
Expand|Select|Wrap|Line Numbers
  1. <%
  2.         if (Cint(catID) = CARS) then
  3.             MakeImage = "/auto_classifieds_images/sh_make.gif"
  4.         elseif (Cint(catID) = TRUCKS) then
  5.             MakeImage = "/auto_classifieds_images/sh_make.gif"
  6.         elseif (Cint(catID) = MOTORCYCLES) then
  7.             MakeImage = "/auto_classifieds_images/sh_make.gif"
  8.         elseif (Cint(catID) = BOATS) then
  9.             MakeImage = "/auto_classifieds_images/sh_boat.gif"
  10.         elseif (Cint(catID) = RVS) then
  11.             MakeImage = "/auto_classifieds_images/sh_make.gif"
  12.         elseif (Cint(catID) = SPECIALTY) then
  13.             MakeImage = "/auto_classifieds_images/sh_specialty.gif"
  14.         end if
  15. %>
Expand|Select|Wrap|Line Numbers
  1. <input type="hidden" name="CategoryID" value="">
  2.    <tr> 
  3.       <td width="100" align="right"><img src="<%= MakeImage %>" width="90" height="28" border="0"></td>
  4.       <td width="200"><select name="Parent1">
  5.             <option value="">----------- Select One -----------</option>
  6.                 <option value="ALL">Select ALL</option>
  7.             <%
  8.    for rowcounter = 0 to numCategoriesRows
  9.       if (arrCategoriesDB(fld_CatParent4,rowcounter) = 0) then
  10.          selectThis = ""
  11.          if ( arrCategoriesDB(fld_CategoryID4,rowcounter) = firstCat1) then
  12.             selectThis = "selected"
  13.          end if
  14.  
  15.             if arrCategoriesDB(fld_CategoryID4,rowcounter) <> 0 then
  16. %>
  17.             <option value="<%= arrCategoriesDB(fld_CategoryID4,rowcounter) %>" <%=selectThis%>><%= arrCategoriesDB(fld_CategoryName4,rowcounter) %></option>
  18.             <%
  19.             end if
  20.       end if
  21.    next
  22. %>
  23.          </select></td>
  24.    </tr>
  25. <script language="javascript">
Expand|Select|Wrap|Line Numbers
  1. <%
  2. if (firstCat1 <> "") then
  3. %>    
  4.     mmChangeContact(document.EDITPRODUCT.Parent1,document.EDITPRODUCT.Parent1, '----------- Select One -----------');
  5.     setDefaultByValue(document.EDITPRODUCT.Parent1,'<%= firstCat1 %>')
  6. <%
  7. end if
  8.  
  9. if (firstCat2 <> "") then
  10. %>
  11. mmChangeContact(document.EDITPRODUCT.Parent1,document.EDITPRODUCT.Child, '----------- Select One -----------');
  12. setDefaultByValue(document.EDITPRODUCT.Child,'<%= firstCat2 %>')
  13. <%
  14. end if
  15.  
  16. if (firstCat3 <> "") then
  17. %>
  18. mmChangeContact(document.EDITPRODUCT.Child,document.EDITPRODUCT.GrandChild, '----------- Select One -----------');
  19. setDefaultByValue(document.EDITPRODUCT.GrandChild,'<%= firstCat3 %>')
  20. <%
  21. end if
  22.  
  23. if (firstCat4 <> "") then
  24. %>
  25. mmChangeContact(document.EDITPRODUCT.GrandChild,document.EDITPRODUCT.GreatGrandChild, '----------- Select One -----------');
  26. setDefaultByValue(document.EDITPRODUCT.GreatGrandChild,'<%= firstCat4 %>')
  27. <%
  28. end if
  29. %>
  30.  
  31. </script>
Nov 29 '07 #3

acoder
Expert Mod 15k+
P: 16,027
Can you post the generated client-side source code instead (using code tags please).
Nov 29 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.