1
以下脚本在Firefox中正常工作,但在IE 8中崩溃且出现“未知运行时错误”错误。使用YUI更改IE 8中的脚本标记的内容
YUI().use('node', function (Y) {
if (Y.one('#testel') == null) {
Y.one('head').append(Y.Node.create('<script id="testel" />'));
}
Y.one('#testel').set('text', 'Wish this would work in IE!');
console.log(Y.one('#testel').get('text'));
});
我与它玩耍了像IE尝试新事物:“意外的调用方法或属性访问”
Y.one('#testel').set('innerHtml', 'Wish this would work in IE!');
Y.one('#testel').set('html', 'Wish this would work in IE!');
Y.one('#testel').setContents('Wish this would work in IE!');
唯一的区别是,有时它赋予了更多有用的错误,这导致我认为脚本标记的文本不能在IE中更改?
虽然四处搜索,但在处理IE中的表格元素时发现了很多对上述问题的引用,但这些情况下的解决方法似乎并不适用于脚本标记。
有什么办法可以在IE中实现上述功能吗? (我只在IE 8中测试过,但我认为问题在6,7中是一样的)。
谢谢!