Scrollbars for Divs in IE not working

I have the following script to create a dropdown Div that provides suggestions for an autosuggest control

AutoSuggestControl.prototype.createDropDown = function () {
      var oThis = this;
      //create the layer and assign styles
      this.layer = document.createElement("div");
      this.layer.className = "rbwhite"; = "none"; = "absolute"; = this.textbox.offsetWidth;
//initially the width of the main div is same as that of the textbox control

      this.layer.innerHTML = '<table width="100%" cellspacing="0" cellpadding="0"><tbody>'+
                        '<tr> <td class="rbs_popup_left"/>'+
                        '<td> <div><div id="suggestions'+this.inputName+'" class="rbwhite" ></div> </div></td>'+
                        '<td class="rbs_popup_right"/> </tr>'+

// <div id="suggestions'+this.inputName+'" class="rbwhite" > is the div that contains all the suggestions. I am having to create so many divs for styling purposes.


when displaying the dropdown I do this

// this is the div that contains all suggestions
this.suggDiv = document.getElementById('suggestions'+this.inputName);

//clear all suggestion if there was any
      this.suggDiv.innerHTML = "";
      var i =0;
//if there are morre than 25 sugestions show vertical scrollbar
         if((this.endPos - this.startPos) >= 25) {
   = "150px";
   = "auto";
      else {
   = "100%";
      var ht =0;

//create individual suggestion divs and append it the main suggestion div
      for (i=this.startPos; i <=this.endPos; i++) {
            oDiv = document.createElement("div");
   = this.idArr[i];
   = "nowrap";
            oDiv.innerHTML = "<a href='#'>" + this.objNameArr[i] + "</a>";

//calculate the longest suggestion
            if(ht < this.objNameArr[i].length) ht = this.objNameArr[i].length;
      var divWidth = ht+160; ( divWidth < 200)? (divWidth+10) +"px" : "200px"; (divWidth) +"px";

//if the longest suggestion is greater than 200px add horizontal scrollbar
      if(divWidth > 200)
     = "auto"; = this.getLeft() + "px"; = (this.getTop()+this.textbox.offsetHeight) + "px"; = "block";

This works well infirefox. Shows both horizontal and vertical scrollbars and I am able to scroll them too.
In IE however only the vertical scrollbar shows up and the horizontal scrollbar never shows up. The vertical scrolbars do not scroll. When I click on the veritcal scrollbar  the textbax.onblur event is fired and the the  divs disappear as the onblur function hides this entire suggestions div.

How to make the scrollbars work in IE?  I have tried overflowX =" scroll" and overflow ="scroll" nothing works,
Who is Participating?
zmoidinConnect With a Mentor Author Commented:
This is supposedly a known IE bug
zmoidinAuthor Commented:
ok I figured out how to display the scrollbars correctly for IE. apparently the Height and width property of the div should be provided implicitly for the scrollbar to work. I was only adding the height for suggDiv.parentNode,  Once I added the the width property for suggDiv.parentNode, the horizontal bars and the vertical bars work fine. Also I had to use the property overflowX= "scroll" and overflowY="scroll" for it to work correctly.

However I still have the problem where, when  I click on either of the scrollbars I am not able to scroll. instead it browser understands it as am onblur event on textbox. How do I make these scrollbars actually scroll?
zmoidinAuthor Commented:
if I disable the onblur event, the scrollbars work fine.

So the problem is that in IE when I click on the scrollbars, other events like textbox.onblur event fires  and causes the suggestions div to hide(on blur is coded to hide suggestions) whereas in firefox this doesnt happen.

Is there a way to recognize the click on scrollbar and prevent the textbox.onblur event not to be called?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.