我有一个Google Map,我用JavaScript代码添加了一些自定义按钮,然后将CSS样式应用于它们。
我的代码在Chrome,Firefox,IE9中显示正常,但在IE8中显示以下错误:
SCRIPT87: Invalid argument
应用CSS的JavaScript代码是这样的:
var controlUI = document.createElement('div');
/* IE10 Consumer Preview */
controlUI.style.backgroundImage = '-ms-linear-gradient(top, #A4A4A4 0%, #6B6B6B 50%)';
/* Mozilla Firefox */
controlUI.style.backgroundImage = ' -moz-linear-gradient(top, #A4A4A4 0%, #6B6B6B 50%)';
/* Opera */
controlUI.style.backgroundImage = '-o-linear-gradient(top, #A4A4A4 0%, #6B6B6B 50%)';
/* Webkit (Safari/Chrome 10) */
controlUI.style.backgroundImage = ' -webkit-gradient(linear, left top, left bottom, color-stop(0, #A4A4A4 ), color-stop(0.5, #6B6B6B))';
/* Webkit (Chrome 11+) */
controlUI.style.backgroundImage = '-webkit-linear-gradient(top, #A4A4A4 0%, #6B6B6B 50%)';
/* W3C Markup, IE10 Release Preview */
controlUI.style.backgroundImage = 'linear-gradient(to bottom, #A4A4A4 0%, #6B6B6B 50%)';
controlUI.style.borderTop = '1px solid rgba(255, 255, 255, 0.8)';
controlUI.style.borderBottom = '1px solid rgba(0, 0, 0, 0.1)';
controlUI.style.borderRadius = '0 0 8px 8px';
最佳答案
IE8不接受使用rgba()颜色的alpha不透明度,您必须使用rgb();