以下是画线的javascript程序和层,我现在要在层内画很大的线图,但它却跑到层外面去画,连层也不见了.请问怎样在层的范围内画曲线? 线图很大的时候,可以通过层的滚动条来看全图.<script language="javascript">var Working=false;
var points = [];
var lastPoint = {x:0,y:0};function drawCanvas()
{
var arr = eval(req.responseText);
      var x1 = arr[0];
var y1 = arr[1];
if(!Working){
document.getElementById("show").style.display="none";
Working=true;
lastPoint.x = x1;
lastPoint.y = y1;
points.push( {x:x1,y:y1} );}else{
var s='<v:line from="'+lastPoint.x+','+lastPoint.y+'" to="'+x1+','+y1+'" style="position:absolute;left:0px;top:0px;"></v:line>';
lastPoint.x = x1;
lastPoint.y = y1;
points.push( {x:x1,y:y1} );var o=document.createElement(s);
document.body.insertAdjacentElement('BeforeEnd',o);
}
}
</script><div id="show" style="overflow: auto;position:relative;height:300px;width:400px;"></div>