Solved

# Drawing a diagonal line

Posted on 2001-07-06

Hi,

I have been struggling finding an easy way to draw a diagonal line. I have found a lot of code that, if I was a bit better at DHTML I should be able to extract, show off an "Analog Clock". These clocks draw diagonal lines, but I couldn't figure out how to break that code out.

If there are any DHTML gurus out there with free time, could you please extract a function for me? If possible I just need to pass 4 variables (starting x,y and ending x,y). The line would be drawn on top of a div.

I am looking for something more than just code that does the x+1,y+1 loop that creates 45 degree angles. I need to be able to pass 2 coordinate pairs (x1,y1,x2,y2) and have a line drawn connnecting the pairs.

thanks