Mysterious character bleed from IE dropdowns

Discussion in 'HTML & Website Design' started by JamieC, May 9, 2006.

  1. #1
    Hi All,

    I'm wondering if any of you HTML gurus can help with a mysterious problem. I have a select dropdown with a fixed width set by CSS and being populated using the DOM. For some reason, in IE the last character of the last option appears to be bleeding out of the drop down. If you click on the letter, the actual dropdown is selected but the mouse pointer is the caret!

    I've included a screenshot below. Any input is greatly appreciated!

    - Jamie
     

    Attached Files:

    JamieC, May 9, 2006 IP
  2. penagate

    penagate Guest

    Messages:
    277
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi,

    That's an odd issue. I can't help much unless you care to post some the JS code you used to populate the select element?

    - P
     
    penagate, May 9, 2006 IP
  3. JamieC

    JamieC Well-Known Member

    Messages:
    226
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    138
    #3
    Yeah I can do:

    
    	// Grab the finish select box for updating
    	finish_select = document.getElementById(finish_id);
    	
    	// Clear out existing elements
    	while (finish_select.options.length) finish_select.options[0] = null;
    
    	// Add the list elements to the dropdown
    	for (i=0;i<surface.finishes.length;i++)
    	{
    		var opt = document.createElement('option');
    		opt.appendChild(document.createTextNode( surface.finishes[i].displayname ));
    		opt.setAttribute('value' , surface.finishes[i].value);
    		finish_select.appendChild(opt);
    	}
    
    Code (markup):
     
    JamieC, May 9, 2006 IP
  4. penagate

    penagate Guest

    Messages:
    277
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Looks fine from a standards point of view. Have you tried using innerHTML instead of createTextNode, for IE?

    As in
    if (navigator.userAgent.indexOf('MSIE')) {
      opt.innerHTML = surfaces.finishes[i].displayname;
    }
    else {
      opt.appendChild(document.createTextNode( surface.finishes[i].displayname ));
    }
    
    Code (markup):
    Browser detects are evil, but it might work?

    - P
     
    penagate, May 9, 2006 IP