Hi,
Below is the code i am currently using to append a child element. It works fine but what I want to achieve is that everytime a new child is added it shows beside the lastchild element.
I have tried
cv = document.getEle mentById("canva s").lastChil d;
but that puts the element inside the lastChild.
Any suggestions?
Below is the code i am currently using to append a child element. It works fine but what I want to achieve is that everytime a new child is added it shows beside the lastchild element.
Code:
var mod_name = document.getElementById('model').value;
document.getElementById('objName').value = "";
if (request.readyState == 4) {
var returned = request.responseText;
var splitResult = returned.split(" ");
var h = splitResult[0];
var w = splitResult[1]; // the dimensions must be set to a scale as they are to big for the screen. 20px represents 100mm
h = h/10;
w = w/10;
cv = document.getElementById("canvas");
var newObject = document.createElement('div');
newObject.Class = mod_name;
newObject.id = g_objName;
newObject.value = objDesc;
newObject.innerHTML = g_objName;
newObject.style.height = h;
newObject.style.width = w;
newObject.onmousedown=function(){grab(this);}
cv.appendChild(newObject);
document.drop_list.objName.focus();
}
cv = document.getEle mentById("canva s").lastChil d;
but that puts the element inside the lastChild.
Any suggestions?
Comment