简体   繁体   English

JS在两个或多个点之间画线

[英]JS Draw line between two or more points

i need to draw a line between two tags or tags. 我需要在两个标签或标签之间画一条线。

Example: 例:
http://caitriona.github.io/connect-the-dots/ http://caitriona.github.io/connect-the-dots/

I need to do something like this but not like in this script, in an order but randomly. 我需要按顺序但随机地执行类似此操作但不喜欢此脚本中的操作。
You can click on "P1" and then on "P2" and the line will be drawn. 您可以单击“ P1”,然后单击“ P2”,然后将绘制线条。 But if you click on "P1" and then on "P3" an error message should appear (that's not the problem). 但是,如果您单击“ P1”,然后单击“ P3”,则会出现一条错误消息(不是问题)。

My problem is, that I'm not so much a javascript crack to draw the line between the points. 我的问题是,我不是一个JavaScript破解者,无法在两点之间划清界限。

Can someone point me to the right direction? 有人可以指出我正确的方向吗?
Thank you! 谢谢!

Take a look at drawing in browser SVG (Scalable Vector Graphics). 看一下浏览器SVG(可缩放矢量图形)中的绘图。 http://www.w3schools.com/graphics/svg_line.asp http://www.w3schools.com/graphics/svg_line.asp

You can do some pretty interesting stuff with it. 您可以使用它来做一些非常有趣的事情。 Go through the W3Schools tutorial. 阅读W3Schools教程。 Let me know how it goes. 让我知道事情的后续。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM