JS在两个或多个点之间画线 [英] JS Draw line between two or more points

查看:89
本文介绍了JS在两个或多个点之间画线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在两个标签或标签之间画一条线。

i need to draw a line between two tags or tags.

示例:

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

我需要执行以下操作,但此脚本中不执行此操作,但顺序是随机的。

您可以单击 P1,然后单击 P2,然后将绘制线条。但是,如果您单击 P1,然后单击 P3,则会出现一条错误消息(这不是问题)。

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. But if you click on "P1" and then on "P3" an error message should appear (that's not the problem).

我的问题是,我不是一个JavaScript破解者,无法在两点之间划清界限。

My problem is, that I'm not so much a javascript crack to draw the line between the points.

有人可以指出我正确的方向吗?

谢谢!

Can someone point me to the right direction?
Thank you!

推荐答案

看看浏览器SVG(可缩放矢量图形)中的绘图。 http://www.w3schools.com/graphics/svg_line.asp

Take a look at drawing in browser SVG (Scalable Vector Graphics). http://www.w3schools.com/graphics/svg_line.asp

您可以用它做一些非常有趣的事情。阅读W3Schools教程。
让我知道怎么回事。

You can do some pretty interesting stuff with it. Go through the W3Schools tutorial. Let me know how it goes.

这篇关于JS在两个或多个点之间画线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆