I want to draw a line on HTML web page dynamically to connect two html elements, which can move on html page.
This action is something like connect two Rectangle's angle, like this:
Is there any way to achieve this?
I want to draw a line on HTML web page dynamically to connect two html elements, which can move on html page.
This action is something like connect two Rectangle's angle, like this:
Is there any way to achieve this?
You may want to look at this tutorial. This tutorial teach you how to draw lines by HTML Canvas API.
HTML5 Canvas Line Tutorial
To draw a line using HTML5 Canvas, we can use the beginPath(), moveTo(), lineTo(), and stroke() methods.
First, we can use the beginPath() method to declare that we are about to draw a new path. Next, we can use the moveTo() method to position the context point (i.e. drawing cursor), and then use the lineTo() method to draw a straight line from the starting position to a new position. Finally, to make the line visible, we can apply a stroke to the line using stroke(). Unless otherwise specified, the stroke color is defaulted to black.
http://www.html5canvastutorials.com/tutorials/html5-canvas-lines/
You could use the HTML5 canvas but you will have to be more specific with your question so we can help you further.