ваый,
if(document.getElementsByClassName) {
getElementsByClass = function(classList, node) {
return (node || document).getElementsByClassName(classList)
}}
else {
getElementsByClass = function(classList, node) {
var node = node || document,
list = node.getElementsByTagName('*'),
length = list.length,
classArray = classList.split(/\s+/),
classes = classArray.length,
result = [], i,j
for(i = 0; i < length; i++) {
for(j = 0; j < classes; j++) {
if(list[i].className.search('\\b' + classArray[j] + '\\b') != -1) {
result.push(list[i])
break
}}}
return result
}}
con=document.getElementById("page");
cont=getElementsByClass("code", con);
for (var i=0;i<cont.length;i++){
code=cont[i].innerHTML;
y=1
getLine=function() {
x=' '
if(y<10){
x=' 0'}
return '<span>'+x+(y++)+' | </span>';
};
code = code.replace(/^\s*/, getLine).replace(/<br.*?\/?>\s*(?!\s*$)/g, function() {
return '<br />'+'<span>'+getLine()+'</span>';
});
cont[i].innerHTML = code;
}
в ие ставит 1 | и все дальше не пашет