by RG9uIFNpbH » Tue, 11 Dec 2007 09:31:00
'm hoping I'm missing something simple and fresh eyes will point out an
obvious issue I'm missing.
Exec summary:
Code that has worked for over 4 years in IE 5.5 and IE 6 causes IE7 to
ignore all input (mouse clicks), until you lose focus on the IE7 window OR
you press the tab key. Users think the page is frozen. Code samples below. I
can provide a link to a working version of the page via private mail but I
can't post it publicly. (It's a complex application.)
DETAILS:
Around 4 years ago we needed a "Editable Dropdown" HTML control for IE 5.5.
HTML doesn't have that control, so we added some JavaScript that makes a
hidden DIV visible when a user clicks on a down arrow button next to a text
box. The div contains a list, user selects something and the onMouseUp event
fires. We take the selection in the list, and move it to the Input box
(text), simulating the behaviors of a native window control. The values in
the list are from a database, and everything is build dynamically.
It has worked for over 4 years in IE 5.5 and all versions of IE 6. In IE7
the browser is unresponsive until the user presses Tab, clicks outside the
IE7 window or otherwise moves focus off, then back to IE7. Then it works as
expected.
We have tried lots of variations of this code, without finding a any
solution. Maybe it will be obvious to the experts here.
Here is the HTML from view source:
<input type='text' style='width: 175px;' value='Committee Meeting'
name='txtDdn_1' id='txtDdn_1' onchange='clearDdn(1);'
onKeyUp='checkReservationType()' maxLength='50' tabIndex='4' ><img
src='/images/buttons/downArrow.gif' onclick='showDdn(1);' align='absmiddle'
name='imgDdn_1'>
<div id='divDdnContent_1'
style='visibility:hidden;z-index:999;width:195;position:absolute;'>
<select id='ddnOptions_1' tabindex='-201' name='ddnOptions_1'
onchange='moveInfo(1);' size='5' style='width:195px;' >
<option value='1'>Client Meeting</option>
<option value='5'>Closing</option>
<option value='4'>Committee Meeting</option>
<option value='2'>Deposition</option>
<option value='9'>Other</option>
</select></div>
JavaScript Functions:
function showDdn(iIndex) {
var oDivDdn = document.getElementById("divDdnContent_" + iIndex);
var oDdnOptions = document.getElementById("ddnOptions_" + iIndex);
var iXOffset = oDivDdn.style.width;
iXOffset = iXOffset.slice(0,iXOffset.length - 2);
oDivDdn.style.top = getDdnY("imgDdn_" + iIndex) + 20;
oDivDdn.style.left = getDdnX("imgDdn_" + iIndex) - iXOffset + 20;
oDivDdn.style.visibility = "visible";
oDdnOptions.focus();
document.attachEvent("onmouseup",hideDdn);
}
function moveInfo(iDdnIndex) {
var oTextField = document.getElementById("txtDdn_" + iDdnIndex);
var oSelectBox = document.getElementById("ddnOptions_" + iDdnIndex);
if(oSelectBox[oSelectBox.selectedIndex].value!='NoRecs'){
oTextField.value = oSelectBox[oSelectBox.selectedIndex].text;
}
}
function clearDdn(iIndex) {
var oSelectBox = document.getElementById("ddnOptions_" + iIndex);
oSelectBox.selectedIndex = -1;
}
function hideDdn() {
// In order for this to work, any editable drop-down fields must be
contained in a div called
// divContent.
var oDivContainer = document.body;
var oDivCurrentDdn;
var sID;
//alert(document.body.all[0].getAttribute("id"));
fo