OK. I finally got it sorted.
I used the following code:-
JS
Code:
function autoComplete(txtbox,listholder,type)
{
var txt = document.getElementById(txtbox);
var list = document.getElementById(listholder);
if (txt.value.length <= 0) {
list.style.display = 'none';
} else {
var posLeft = findPos(txt)[0];
var posTop = findPos(txt)[1];
list.style.left = posLeft;
list.style.top = (posTop+txt.offsetHeight);
list.style.display = '';
}
}
function findPos(obj) {
var oNode = obj;
var curleft = 0;
var curtop = 0;
if (obj.offsetParent) {
do {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
} while (obj = obj.offsetParent);
}
return [curleft, curtop];
}
The thing that finally sorted it was putting the autocomplete div holder as the final element on my page. ie I placed it on my master page, just above the </form> tag.
The absolute positioning then works.
Just need to sort out the disappearing behind dropdownlists issue...
<edit>Actually, just found that this isn't working in FF..
</edit>
Bookmarks