I have this strange problem when replacing a div node with a img node where it adds somehow 5px to my img.
Eg: then click on "test"
As you may notice, the node doesn't fit anymore.
Here's the code to create the img node:
function fCreateImg(name) {
this.imgNodeArr[name] = document.createElement("img"
;
this.imgNodeArr[name].src = testImg.src
this.imgNodeArr[name].style.height = "245px"; //I've found out that by removing 5px to this value, it fits perfectly.
this.imgNodeArr[name].style.width = "396px";
this.imgNodeArr[name].id = name;
return null;
}
here's the switching code:
function fSwitchNode(oldNode, oldChild, type, name) {
var elmtParent = document.getElementById(oldNode);
var elmtOld = document.getElementById(oldChild);
var newElmnt = this[type + "NodeArr"][name];
newElmnt.id = oldChild;
var replaced = elmtParent.replaceChild(newElmnt, elmtOld);
return null;
}
thks in advance for any suggestions
Eg: then click on "test"
As you may notice, the node doesn't fit anymore.
Here's the code to create the img node:
function fCreateImg(name) {
this.imgNodeArr[name] = document.createElement("img"
this.imgNodeArr[name].src = testImg.src
this.imgNodeArr[name].style.height = "245px"; //I've found out that by removing 5px to this value, it fits perfectly.
this.imgNodeArr[name].style.width = "396px";
this.imgNodeArr[name].id = name;
return null;
}
here's the switching code:
function fSwitchNode(oldNode, oldChild, type, name) {
var elmtParent = document.getElementById(oldNode);
var elmtOld = document.getElementById(oldChild);
var newElmnt = this[type + "NodeArr"][name];
newElmnt.id = oldChild;
var replaced = elmtParent.replaceChild(newElmnt, elmtOld);
return null;
}
thks in advance for any suggestions