简体   繁体   中英

JavaScript works in IE + Chrome but not FF

The following works in IE and Chrom but not FF. Thanks

<script>
    Element.setStyle(('table'), {
        'background-image': 'none'
    });
    Element.setStyle(('panel'), {
        'background-image': 'url(/pic.jpg)',
        'background-repeat': 'no-repeat'
    });
</script>

I'm not familiar with the setStyle function you're using, but when using JavaScript, Firefox is more particular about hyphens within CSS property names than other browsers.

Where style property names have hyphens, you should be using lower-case camel caplitalization instead - so 'background-image' should be 'backgroundImage' etc. Property values like 'no-repeat' are fine as they are.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM