使用 Dojo 在 IE 中创建样式对象时出错

Error on creating style object in IE with Dojo

此代码在 FF 中运行良好,但在 IE v9 中会引发错误:

var iconStyle = dojo.create('style', { 
   innerHTML:  '.ZMyToolbarBtn { background-image: url("../resources/toolbar/my.png"); }' 
});
dojo.doc.body.appendChild(iconStyle);

要获得跨浏览器版本,你最好使用dojox/html/styles

dojoxStyles.insertCssRule('ZMyToolbarBtn', 'background-image: url("../resources/toolbar/my.png");')