我试图让 pretty.js 使用这个 js 来美化 CODE 标签中的代码:
onload_functions.push(function() {
var node_list=document.getElementsByTagName('code');
for (i=0; i < node_list.length; i++) {
node_list[i].setAttribute('class','prettyprint');
}
prettyPrint();
});
这适用于 Firefox :) 但 IE 没有。我究竟做错了什么?
您可以在http://sam.xnet.tk看到它(非)工作