короче, там до@#$ ошибок, я не понял что ты хотел, починил чуть-чуть чтобы рисовало поли-линию:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="200" height="240" xmlns="http://www.w3.org/2000/svg" version="1.1" onclick="addpnt()" onmousemove="gxy(evt); lastpt(); drawpt(100);">
<script><![CDATA[
pnt = [[0,0]];
cx = 0;
cy = 0;
function ge(a) {
return document.getElementById(a);
}
function gxy(e) {
cx = e.clientX;
cy = e.clientY;
}
function downexp(p, t) {
return p;
/*
var cp = [];
var cnt = p.length-1;
cp[0] = p;
for (i=0;i<cnt;i++) {
cntt = cp[i].length-1;
for (j=0;j<cntt;j++) {
cp[i+1][j][0]=cp[i][j][0]+t*(cp[i][j+1][0]-cp[i][j][0]);
cp[i+1][j][1]=cp[i][j][1]+t*(cp[i][j+1][1]-cp[i][j][1]);
}
}
return cp[cnt][0];
*/
}
function addpnt() {
var cnt = pnt.length;
pnt[cnt] = [];
pnt[cnt][0] = cx;
pnt[cnt][1] = cy;
}
function lastpt() {
var cnt = pnt.length-1;
pnt[cnt][0] = cx;
pnt[cnt][1] = cy;
}
function drawpt(n) {
var t = 1/n,
pa = [],
ln = ge('line'),
ptt = '',
cnt = pnt.length;
/*
for(j=0;j<n;j++) {
pa[j] = downexp(pnt, t*j);
}
*/
function A(e,a,v){e.setAttribute(a,v)}
function C(i){var e = document.createElementNS('http://www.w3.org/2000/svg',i); A(e, 'shape-rendering', 'auto'); return e}
var z = C('polyline');
A(z, 'points', cx+','+cy);
ln.points.appendItem(z.points.getItem(0));
z = null
}
]]>
</script>
<polyline points="0,0 1,1" id="line" stroke="red" stroke-width="3" fill="none"/>
</svg>