function createLineWithDOM(p, color, width, fx, fy, tx, ty) {
var l, d, i; l = document.createElement("v:line");
l.strokeweight = width+"pt";
l.strokecolor = color;
l.from = fx + "px, " + fy + "px";
l.to = tx + "px, " + ty + "px";
p.insertBefore(l, null);
}这个是vml.....
var l, d, i; l = document.createElement("v:line");
l.strokeweight = width+"pt";
l.strokecolor = color;
l.from = fx + "px, " + fy + "px";
l.to = tx + "px, " + ty + "px";
p.insertBefore(l, null);
}这个是vml.....
用insertAdjacentHTML这个方法代替createObject然后插入的方式
会快很多function createLineWithDOM(p, color, width, fx, fy, tx, ty) {
var s='<v:line strokeweight="'+width+'pt" strokecolor="'+color+'" from="'+fx + 'px, ' + fy + 'px">'
p.insertAdjacentHTML('beforeBegin',s);
}