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.
Javascript
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>
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>
Comment