IE 7 freezing on DIV Selection list

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cranger01
    New Member
    • Feb 2008
    • 11

    IE 7 freezing on DIV Selection list

    Hi all. I have posted this question in several places and read hundreds of posts on the subject, yet I can not seem to find my solution.

    Problem is how my screen is functioning between IE 6 and IE 7 on a Windows 2000 server. It seems that not only are my javascript events firing in different order, but my IE 7 page freezes after selecting an item in a div cbo box. The Div closes and the screen hangs. Putting alerts in the javascript, I can see what is firing and likewise, the alerts prevent the screen from firing.

    I did not write the original code. I am hoping someone may have had similar issues to which they could offer some suggestions or a solution.

    Code:
    Posting the ASP code as well as all the relevant JS Code.  
    
    								<form id="frmSearch" name="frmSearch" method="post" 								       
    								      action="customerGroupMaintainanceFrame_View.asp">
    									<tr align="center">										
    										<td>
    											<input type="text" name="txtCustomer" id="txtCustomer" 
    												   onKeyup="CustomerKeyIn(this)" autocomplete="off" 
    												   onfocus="fnselect()" 
    												   onblur="fnblur()" class = "txtXLarge"
    												   maxlength="30" size="41" value=""/>
    										</td>																				
    									</tr>
    									<tr>
    										<td width="50"></td>
    										<td>
    										<div id="divCustomerGroup" 
    											 style="position:absolute; width:188px; height:98px;
    											        visibility:hidden; z-index:1; top: 108px;left:375px"
    											 name="divCustomerGroup">
    											<select  name="cboCustomerInfo"  id="cboCustomerInfo" size="5" 
    												     onclick="fnclick();"  onChange="SearchForValues()" onfocus="fnfocus()"
    												     style = "width:250px;">
    												<% 
    													'Display the resulting values in the table till there 
    													'is no rows in recordset
    													If Not  rsCustRecord.EOF Then 
    														While Not rsCustRecord.EOF 
    															lsGroupName = Trim(rsCustRecord(0) & "")
    																If lsOriginalCustomerGroup = lsGroupName Then
    												%>
    													<option value="<% = lsGroupName %>"  selected="">
    													<% = lsGroupName%>
    													</option>
    													<%			Else   %>
    													<option value="<% = lsGroupName%>">
    													<% = lsGroupName %>
    													</option>
    												<%
    																End If
    															rsCustRecord.MoveNext 
    														Wend
    													End If		
    													'Close The Recordset
    								                    rsCustRecord.Close
    								                    Set rsCustRecord = Nothing
    								                    'Close the com object
                                                        Set lcomCustMaint = nothing
    												%>
    												</select>
    											</div>
    Javascript

    Code:
    <script language="javascript">
    <!--
    
    function SearchForValues()
    {
    	//submit the form to the server
    	
    	var selindex;
    	selindex = document.frmSearch.cboCustomerInfo.selectedIndex;
    	document.forms(0).item('cboCustomerInfo').blur();
    	if (selindex != -1)
    	 {
    		selname = document.frmSearch.cboCustomerInfo[selindex].text;
    		document.frmSearch.txtCustomer.value = selname;
    		document.all["divIfm"].style.visibility = "";
    		document.all["divCustomerGroup"].style.visibility = "hidden";
    	 }
    	 else
    	 {
    	    document.all["divIfm"].style.visibility = "hidden";
    	 }
    
    	frmSearch.target = "ifmList"
    	frmSearch.submit();
    
    	//frmSearch.target = "";
    }
    
    function CustomerKeyIn(txtValue)
    {
    	
    	var lsKeyInValue = txtValue.value.toUpperCase();
    	var liIndex = 0;
    	var lsCheckValue;	
    	var liKeyInLength;
    	var iSelIndex;
    	liKeyInLength = lsKeyInValue.length;
    	var lblnFlg = false;
    	var liCount = document.frmSearch.cboCustomerInfo.length;
    	iSelIndex =  document.frmSearch.cboCustomerInfo.selectedIndex
    	if(event.keyCode == 13)
    	{
    		
    	    fnclick()
    	    frmSearch.target = "ifmList";
    	    document.frmSearch.submit();
    	    //frmSearch.target = "";
    	    window.focus()
    	    return
    	}
    	//Down Arrow
    	if(event.keyCode == 40)
    	{
    		
    	    if(iSelIndex < liCount - 2)
    	    {	    
    	        iSelIndex = iSelIndex + 1
    	        document.frmSearch.cboCustomerInfo.options[iSelIndex].selected  = true 
    	        document.frmSearch.txtCustomer.value = document.frmSearch.cboCustomerInfo.options[iSelIndex].value
    	        return
    	    }	    
    	}
    	
    	//Up Arrow	
    	if(event.keyCode == 38)
    	{
    		
    	    if(iSelIndex > 0 )
    	    {	    
    	        iSelIndex = iSelIndex - 1;
    	        document.frmSearch.cboCustomerInfo.options[iSelIndex].selected  = true ;
    	        document.frmSearch.txtCustomer.value = document.frmSearch.cboCustomerInfo.options[iSelIndex].value;
    	        return
    	    }	    
    	}
        //tab Key
        if(event.keyCode == 9)
        {
        	
            if((iSelIndex >= 0) && (iSelIndex < liCount))
    	    {
    	        var selindx;
    	        selindex = document.frmSearch.cboCustomerInfo.selectedIndex;
    	        document.frmSearch.txtCustomer.value = document.frmSearch.cboCustomerInfo[selindex].text;
    	        document.all["divCustomerGroup"].style.visibility = "hidden";
    	        document.all["divIfm"].style.visibility = "";
    	        document.frmSearch.btnDel.focus;
    	        frmSearch.target = "ifmList";
    	        document.frmSearch.submit();
    	        //frmSearch.target = "";
    	        return
    	    }	
    	    else
    	    {
    	        document.all["divIfm"].style.visibility = "hidden";
    	    }  
        }
    	while(liIndex <= liCount - 1)
    	{
    		lsCheckValue = document.frmSearch.cboCustomerInfo[liIndex].value.toUpperCase();
    		if(lsKeyInValue.substring(0,liKeyInLength) == lsCheckValue.substring(0,liKeyInLength))
    		{
    			document.frmSearch.cboCustomerInfo.selectedIndex = liIndex;
    			lblnFlg = true;
    		}
    		else
    		{
    		
    		    lblnFlg = false;
    		}
    		if(lblnFlg)
    		{
    		    break;
    		}
    		else
    		{
    			liIndex = liIndex+1;			
    		}
    	}
    }
    
    function fnclick()
    {
    	
    	var selindx;
    	var liCount = document.frmSearch.cboCustomerInfo.length;
    	selindex = document.frmSearch.cboCustomerInfo.selectedIndex;
    	if ((selindex >=  0) && (selindex < liCount))
    	{
    		selname = document.frmSearch.cboCustomerInfo[selindex].text;
    		document.frmSearch.txtCustomer.value = selname;
    		document.all["divCustomerGroup"].style.visibility = "hidden";
    		document.all["divIfm"].style.visibility = "";
    	}
    	else
    	{
    	 document.all["divIfm"].style.visibility = "hidden";
    	}   
    }
    function fnselect()
    {
    	
    	divCustomerGroup.style.visibility = "visible";
    	document.frmSearch.txtCustomer.focus();
    	document.frmSearch.txtCustomer.select();
    
    }
    
    function fnblur()
    {
    	
    	var selindx;
    	var liCount = document.frmSearch.cboCustomerInfo.length;
    	selindex = document.frmSearch.cboCustomerInfo.selectedIndex;
    	if ((selindex >= 0) && (selindex < liCount))
    	{
    		selname = document.frmSearch.cboCustomerInfo[selindex].text;
    		document.frmSearch.txtCustomer.value = selname;
    		document.all["divCustomerGroup"].style.visibility = "hidden";
    		document.all["divIfm"].style.visibility = "";
    		
    		frmSearch.target = "ifmList";		
    		document.frmSearch.submit();
    		//frmSearch.target = "";
    	}
    	else
    	{
    		document.all["divIfm"].style.visibility = "hidden";
    		document.all["divCustomerGroup"].style.visibility = "hidden";
    	
    	}   
    
    }
    
    function fnEnter()
    {
    	
    	if (event.keyCode == 13)
    	{
    		RefreshAdd();
    	}
    }
    function fnfocus()
    {
    	
    	    document.all["divCustomerGroup"].style.visibility = "visible";
    }
    function FormFocus()
    {
    document.body.blur();
    document.body.focus(); 
    }
    
    -->
    </script>
  • scripto
    New Member
    • Oct 2006
    • 143

    #2
    for every occurance replace
    .style.visibili ty = "";
    with
    .style.visibili ty = "visible";

    Comment

    • cranger01
      New Member
      • Feb 2008
      • 11

      #3
      Scripto, thanks for your reply...

      My issue sort of relates to this more, though there is no resolution posted




      After reading this thread, I did notice if I tab, my cursor actually reappears and the "freezing stops".

      I also want to point out that when something is selected from the cbocustomergrou p, i bring up another .asp page in an iframe. So somewhere in there the screen freezing or cursor disappearance is where it is occuring.

      Also, for the freezing, the events that fire prior to losing my cursor are searchforvalues , fnblur, fnfocus.

      fnfocus was added because the scrolling functionality of that box was not working because it didn't recognize that that div had focus.

      Comment

      • cranger01
        New Member
        • Feb 2008
        • 11

        #4
        sorry, just posting again to get this to the top.

        If I error the page, it actually works correctly. I think I am so close to the answer, just my limited knowledge keeps adding 2 + 2 and getting 3.

        Let me know if something is unclear or if you need more info. Site is an intranet, so I can not post a link.

        Comment

        • cranger01
          New Member
          • Feb 2008
          • 11

          #5
          IE 7 Hangs after JS Script Run

          I posted this question early, but to no avail. However, I found a similar issue and a code snippet to match so you can run it on IE 7. As typically what I find, there is never a resolution posted back as was the case here. The thread was locked where I found it, so could not reply or message the original poster.

          Link to test page is http://jscripttest.baarns.com

          Can right click to see source. I am basically having the same issue with IE 7. Works in IE 6. If I select from a "Div", the page freezes. Only way to unfreeze page is to tab, or alt d, or anyother screen event. I know someone has the answer.

          Original Thread for all the comments



          I am at my wits end here...Please help!!!!!
          Last edited by acoder; Feb 14 '08, 09:22 AM.

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Threads merged. If you need to bring it to the top, just give a bump after a day or two.

            Why not use a simple combo box like this?

            Comment

            • cranger01
              New Member
              • Feb 2008
              • 11

              #7
              Users like the look and feel of current set up (as it works in IE 6). However, if this continues, they may have no choice. Thanks for the suggestion though.

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                Do your users only use IE? Your code would only work in IE.

                Comment

                • cranger01
                  New Member
                  • Feb 2008
                  • 11

                  #9
                  Yes, IE is the standard. This is for an Intranet application, so we control that.

                  Comment

                  • acoder
                    Recognized Expert MVP
                    • Nov 2006
                    • 16032

                    #10
                    It may be caused by a timing bug (as mentioned in this page - see updates).

                    Comment

                    • cranger01
                      New Member
                      • Feb 2008
                      • 11

                      #11
                      Originally posted by acoder
                      It may be caused by a timing bug (as mentioned in this page - see updates).

                      I just tried it. Still no luck.

                      Comment

                      • acoder
                        Recognized Expert MVP
                        • Nov 2006
                        • 16032

                        #12
                        Most likely what is happening is that the div which has closed still has focus. You may need to blur and then focus on another element before closing the div.

                        Comment

                        • cranger01
                          New Member
                          • Feb 2008
                          • 11

                          #13
                          I have tried variations of that concept before. Either I am just not putting it in the right place, or that is not my solution. Especially in this screen, there is no where else to but the focus except on the page. After the selection I open up an Iframe. I do have 9 screens effected. I have some meetings this morning, but will post back what I find afterwards. Still open for any other suggestions.

                          Comment

                          • acoder
                            Recognized Expert MVP
                            • Nov 2006
                            • 16032

                            #14
                            Originally posted by cranger01
                            Especially in this screen, there is no where else to but the focus except on the page. After the selection I open up an Iframe.
                            Not even a text box? You could also try an element within the iframe.

                            Comment

                            • cranger01
                              New Member
                              • Feb 2008
                              • 11

                              #15
                              Originally posted by acoder
                              Not even a text box? You could also try an element within the iframe.

                              I did try to play around with using a variable, so if an item was selected and the div lost focus, DO NOT reset focus on the txt box.

                              Iframe is basically a display. no input fields. I tried ID'ing the page and set focus to that (from parent) and then inside that .asp on the onload. No success. It may just be my lack of knowlegde and I could be doing this in the wrong place.

                              Comment

                              Working...