I switched to using this function to create element:
—————————————————-
[CODE]
function elem(name, attrs, style, text) {
var e = document.createElement(name);
if (attrs) {
for (key in attrs) {
if (key == ‘class’) {
e.className = attrs[key];
} else if (key == ‘id’) {
e.id = attrs[key];
} else {
e.setAttribute(key, attrs[key]);
}
}
}
if (style) {
for (key in style) {
e.style[key] = style[key];
}
}
if (text) {
e.appendChild(document.createTextNode(text));
}
return e;
}
———————————————————
so instead of the “old” way:
[COLOR=Navy]var oMyDiv = document.createElement(“DIV”);
oMyDiv.setAttribute(“id”,”testid”);
oMyDiv.className = “testclass”;
I use that function :
[COLOR=Navy]var oMyDiv = elem(‘DIV’, {‘id’:’testid’, ‘class’:’testclass’});
Rendered source shows this:
[COLOR=RED] <div extend=” function (object) {return Object.extend.apply(this, [this,object]); } “class=”testclass” id=”testid”>
Question: the “EXTEND” part is beyond me……anyways does it look
legit/right ? ?
Any if you please ….put this
“[COLOR=RED]extend=” function (object) {return Object.extend.apply(this, [this, object]); }
thanks