Marek123
Marek123

Reputation: 1211

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/

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).

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!

Upvotes: 5

Views: 34160

Answers (1)

shadowcursor
shadowcursor

Reputation: 1224

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

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

Upvotes: 13

Related Questions