I was trying to improve PPK's JIR script by using XML. I have this code:
function init()
{
var x = document.getElementsByTagName('replace');
var prefix = 'http://www.quirksmode.org/dom/pix/';
var suffix = '.gif';
for (var i=0;i<x.length;i++)
{
if (x[i].getAttribute('url'))
{
var y = replace.cloneNode(true);
y.replacedHeader = x[i];
outimage = prefix + x[i].getAttribute('url') + suffix;
outalt = x[i].firstChild.nodeValue;
var replace='<img src="'+outimage+'" alt="'+outalt+'">';
y.onload = function () {
this.replacedHeader.innerHTML=replace;
};
}
}
}
I'm sure there's plenty of things wrong with it that I missed...is there?