我用于创建行并从数据库中获取值的代码:
var response = JSON.parse(this.responseText);
for(var ii=0; ii<response.length; ii++)
{
var road = document.createElementNS("http://www.w3.org/2000/svg", "line");
road.x1.baseVal.value = response[ii].Linex1;
road.y1.baseVal.value = response[ii].Liney1;
road.x2.baseVal.value = response[ii].Linex2;
road.y2.baseVal.value = response[ii].Liney2;
road.setAttributeNS(null, "stroke", "#686968"); *
road.setAttributeNS(null, "stroke-width", "14.520");
road.setAttributeNS(null, "stroke-linecap", "round");
road.setAttributeNS(null, "fill", "none");
glblGeogSorc.getElementsByTagName("g")[0].appendChild(road);
}
我的目标是删除与 x1、x2、y1 和 y2 对应的特定 svgline elem。