Jump to content

[SOLVED] delete object


cleary1981

Recommended Posts

Hi I'm having a problem trying to delete an object in javascript. Heres the code I used to create it.

 

function showObject (){
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. 25px represents 100mm
h = h/5;
w = w/5;

cv = document.getElementById("canvas");
newObject = document.createElement('div');
newObject.Class = g_objName;
newObject.id = "newObject";
newObject.innerHTML = g_objName;
newObject.alt = g_objName;
newObject.style.height = h;
newObject.style.width = w;
newObject.onmousedown=function(){grab(this);}	
cv.appendChild(newObject);
}
}

 

heres what I have so far on the delete function

 

function obj_delete() {
var obj_name = document.getElementById("object").value;
var proj_id = document.getElementById("projID").value;
var url = "deleteObject.php?obj_name=" + escape(obj_name) + "&proj_id=" + escape(proj_id);
request.open("GET", url, true);
request.send(null);
delete canvas.Child;
}

 

As you can see from my code I have deleted the object in my db ok but I need to be able to delete the object on the webpage. newObject where its innerHTML = var obj_name in the delete function. Any help much appreciated.

Link to comment
https://forums.phpfreaks.com/topic/117307-solved-delete-object/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.