如何用JS画线?如何用JS画线让两个DIV相连

darkfxux7788 2008-03-03 09:52:35
如何用JS画线?如何用JS画线让两个DIV相连
求高人指点
...全文
2476 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
peter_666 2009-09-03
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 mrshelly 的回复:]
建议用FLASH
[/Quote]
就知道flash,也要看需求吧
darkfxux7788 2008-03-12
  • 打赏
  • 举报
回复
如何相互避让?
darkfxux7788 2008-03-04
  • 打赏
  • 举报
回复
mrshelly兄弟。。。。。说了半天就是不用FLASH呀
mrshelly 2008-03-04
  • 打赏
  • 举报
回复
建议用FLASH
darkfxux7788 2008-03-04
  • 打赏
  • 举报
回复
那样做还是没办法都兼顾咯?
有没有两种都可以照顾的到的非图片的画线
ghtyan 2008-03-04
  • 打赏
  • 举报
回复
IE下画线

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<style type="text/css">
v\:* { behavior:url(#default#VML); }
</style>
</head>
<body>
<v:line
from='200,200'
to='300,100'
style='position:absolute;z-index:8'>
</v:line>
</body>
</html>

<script>
var R =function(){};
R.prototype.createLine = function (startX,startY,endX,endY){
var le = document.createElement( "<v:line><v:line>" );
le.from = startX + ',' + startY ;
le.to = endX + ',' + endY ;
le.strokecolor= "red" ;
le.strokeweight= "1pt" ;
return le;
}
var d =new R();
document.body.appendChild(d.createLine(1,1,200,100));
</script>





FF下画线


<html>
<head>
<title>A canvas fillRect, strokeRect and clearRect example</title>
<meta name="DC.creator" content="Kamiel Martinet, http://www.martinet.nl/">
<meta name="DC.publisher" content="Mozilla Developer Center, http://developer.mozilla.org">
<script type="text/javascript">
function drawShape(){
// get the canvas element using the DOM
var canvas = document.getElementById('tutorial');

// Make sure we don't execute when canvas isn't supported

if (canvas.getContext){

// use getContext to use the canvas for drawing
var ctx = canvas.getContext('2d');

// Draw shapes
ctx.fillRect(25,25,100,100);
ctx.clearRect(45,45,60,60);
ctx.strokeRect(50,50,50,50);

ctx.beginPath();
ctx.moveTo(100,100);
ctx.lineTo(200,250);
ctx.lineTo(50,250);
ctx.closePath();
ctx.stroke();

} else {
alert('You need Safari or Firefox 1.5+ to see this demo.');
}
}
</script>
<style type="text/css">
</style>
</head>

<body onload="drawShape();">
<div>
<canvas id="tutorial" width="400" height="400"></canvas>
</div>
</body>

</html>


  • 打赏
  • 举报
回复
那是用VML画的吧
darkfxux7788 2008-03-03
  • 打赏
  • 举报
回复
就类似于工程图那种
varlj 2008-03-03
  • 打赏
  • 举报
回复
直接在浏览器上画,可以找一下VML,或者SVG,不过两者似乎都没能做到全浏览器支持

还有就是使用img,div之类的,设置成纯色背景,用来模拟成线
回.到.未来 2008-03-03
  • 打赏
  • 举报
回复
是啊 。怎么连?
javacb 2008-03-03
  • 打赏
  • 举报
回复
怎么练?再说详细点

87,993

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧