我使用谷歌地图,我正在添加一些带有 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';