这个别人弄得控件可以实现在文本框输入字符之后,系统自动去数据库viewtable中查找含有对应字符的备选结果,然后返回一个列表,用户点击即可将值放到textbox上,
现在的问题是 在div的背后总有一个300*150的白框背景显示在那,但我怎么也找不到去掉这个背景框的地方,想请教高手麻烦帮找找,多谢~~ 一会儿上截屏~ <Scripts><asp:ScriptReference Path="~/JavaScript/Search.js" /></Scripts>
function Get(o) {
    $get(o.id + "hid").value = "";
    var searchtext = o.value;
    SearchItems(o,searchtext);    
}function ListAllItems(o) {
    $get(o.id + "hid").value = "";
    var searchtext = o.value;
    SearchItems(o, searchtext);
}function SearchItems(o, searchtext) {
    var table = o.Table;
    var textField = o.FieldText;
    var valueField = o.FieldValue;    
    var wherestr = o.WhereStr;
    var id = o.id;
    var ListCount = 1+parseInt(o.ListCount);
    var CacheTime = o.CacheTime;
    DeliveryTools.WebServices.ShinService.GetSearch(table, textField, valueField, searchtext, wherestr, ListCount, CacheTime, OnComplete, OnError, id);
}//执行成功返回结果
function OnComplete(result, tid) {
    var listlength = result.length;    
    var definedlength=parseInt($get(tid).ListCount);    
    var isAddMoreLi=listlength==definedlength+1;    
    if(listlength>definedlength)
    {
        listlength=definedlength;
    }    
    var createDiv = $get("div" + tid);
    if (listlength < 1) {
        if (createDiv != null) {
            document.body.removeChild(createDiv);
        }
        return;
    }
    var htmlText = "<iframe style='position:absolute;z-index:-1;width:e­xpression(this.nextSibling.offsetWidth);height:e­xpression(this.nextSibling.offsetHeight);top:e­xpression(this.nextSibling.offsetTop);left:e­xpression(this.nextSibling.offsetLeft);' frameborder='0'></iframe><UL class='completionListElement' id='ul" + tid + "'>";
    for (var i = 0; i < listlength; i++) {
        htmlText += "\n<LI class='listItem' onmouseover=this.className='highlightedListItem' onmouseout=this.className='listItem' onclick=SetTextValue(this,'" + tid + "')  id=li" + tid + i;
        htmlText += " TValue='" + result[i].ListValue + "'";
        htmlText += " TText='" + result[i].ListText + "'>";
        var stemp = "" + result[i].ListText;
        var regexp = RegExp("(" + $get(tid).value + ")", "ig");///*
        htmlText += stemp.replace(regexp, "<font color=red><b>$1</b></font>");
        htmlText += "</LI>";
    }
    if(isAddMoreLi)
    {
        htmlText += "\n<LI class='listItem' style='cursor:default;' id=limore>……</LI>";
    }
    htmlText += "\n</UL>";
    htmlText += "<iframe src=\"javascript:false\" style=\"position:absolute; visibility:inherit; display:none; top:0px; left:0px; width:100px; height:200px; z-index:-1; filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';\"></iframe>";
    htmlText +="</BR>";
    //判断DIV是否为空
    if (createDiv == null) {
        createDiv = document.createElement("div");
        document.body.appendChild(createDiv);
        createDiv.id = "div" + tid;
        createDiv.style.zIndex = 9999;
        createDiv.style.width = $get(tid).clientWidth + 5; //文本框的宽度+5px
        createDiv.style.position = 'absolute';
    }
    createDiv.innerHTML = htmlText;
    ShowSearchDiv("div" + tid, tid);
}function OnError(result) {
    //alert("请检查控件属性(Table、Field..)");    
}//设置返回值
function SetTextValue(o, tid) {
    $get(tid + "hid").value = o.TValue;
    $get(tid).value = o.TText;
    document.body.removeChild($get("div" + tid));
}//当鼠标离开文本框是设置DIV隐藏
function SetDivState(o) {
    var ischeck = o.CheckNull;
    if (ischeck != 'false' && !CheckSelectedValue(o)) {
        $get(o.id + "hid").value = "";
        o.value = "";
    }
    window.setTimeout(function() {
        var tid = o.id;
        var createDiv = $get("div" + tid);
        // if (createDiv != null && document.activeElement.tagName.toUpperCase() != "HTML") 
        if (createDiv != null) {
            document.body.removeChild(createDiv);
        }
    }, 200 );
}//检查录入的数据是否存在
function CheckSelectedValue(o) {
    var tvalue = $get(o.id + "hid").value;
    var ttext = o.value;
    var ul = $get("ul" + o.id);
    if (ul == null)
        return false;
    var oul = ul.getElementsByTagName('LI');
    if (oul == null)
        return false;
    for (var i = 0; i < oul.length; i++) {
        if(oul[i].attributes["TValue"]!=null)
        {
            var livalue = oul[i].attributes["TValue"].nodeValue;
            var litext = oul[i].attributes["TText"].nodeValue;
            if (litext == ttext) {
                $get(o.id + "hid").value = livalue;
                return true;
            }
        }
    }
    return false;
}function ShowSearchDiv(divID, txtID) {
    document.all(divID).style.display = "";
    //SelectOrder 是要显示的层的ID
    var drp = document.all(divID);
    var obj = document.all(txtID);
    //btnOrderIn 是要显示在的目标控件的ID
    if (drp) {
        var objs = obj;
        var t = obj.offsetTop, h = obj.clientHeight, l = obj.offsetLeft, p = obj.type;
        while (obj = obj.offsetParent) { t += obj.offsetTop; l += obj.offsetLeft; }
        var cw = drp.clientWidth, ch = drp.clientHeight;
        var dw = document.body.clientWidth, dl = document.body.scrollLeft, dt = document.body.scrollTop;
        //                    if (document.body.clientHeight + dt - t - h >= ch)
        //                        drp.style.top = (p == 'image') ? t + h : t + h + 6;
        //                    else
        //drp.style.top = (t - dt < ch) ? ((p == 'image') ? t + h : t + h + 6) : t - ch;        //修改
        if (p == 'image') {
            drp.style.top = t + h
        }
        else {
            drp.style.top = t + h + 6;
        }        if (dw + dl - l >= cw)
            drp.style.left = l;
        else
            drp.style.left = (dw >= cw) ? dw - cw + dl : dl;
            drp.style.visibility = 'visible';
    }
}