Prototype setStyle not working in IE6.

Posted by Smickie on Stack Overflow See other posts from Stack Overflow or by Smickie
Published on 2010-03-15T11:57:28Z Indexed on 2010/03/15 11:59 UTC
Read the original article Hit count: 129

Filed under:
|
|
|
|

Hi,

I'm using prototype and setStyle in IE6 is just messing everything up. It's throwing a big error.

I've Googled it but cant find a solution.

I've identified the line in prototype with the IE script debugger, it's the final else block:

setStyle: function(element, styles) {
    element = $(element);
    var elementStyle = element.style, match;
    if (Object.isString(styles)) {
      element.style.cssText += ';' + styles;
      return styles.include('opacity') ?
        element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
    }
    for (var property in styles)
      if (property == 'opacity') element.setOpacity(styles[property]);
      else
        elementStyle[(property == 'float' || property == 'cssFloat') ?
          (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
            property] = styles[property];

    return element;
  },

Anyone had this problem?

P.S. normally I would use jQuery however this is someone else code I've had to update.

© Stack Overflow or respective owner

Related posts about prototype

Related posts about setstyle