<! xmlns = "http://www.w3.org/1999/xhtml"> <head> <meta http-equiv = "content-type" content = "text/html; charset = utf-8"/> title> não titlest. } </style> <script type = "text/javascript">/** Desenham pontos*/function makedot (x, y) {pointdiv = "<div style = 'altura: 1px; posição: absoluto; esquerda:" + x + "px; top:" + y + "px; width: 1px; background:#flowfrof; Retorno PointDiv;} /** Desenhe uma linha reta com base nas coordenadas dos dois pontos. */ linha de função (x1, y1, x2, y2) {var slope; // slope var direction; // coordenar movimento var tx = x2 - x1; var ty = y2 - y1; if (tx == 0 && ty == 0) return; var points = ""; var axis; // coordena no eixo if (math.abs (tx)> = math.abs (ty)) {// mover direção = tx> 0? 1: -1; tx = math.abs (tx); inclinação = ty / tx; eixo = x1; for (i = 0; i <tx; i ++) {pontos += makedot (eixo, y1 +i * inclinação); eixo += direção; }} else {// Mova a direção na direção y-eixo = ty> 0? 1: -1; ty = math.abs (ty); inclinação = tx / ty; eixo = y1; for (i = 0; i <ty; i ++) {pontos += makedot (x1 +i * inclinação, eixo); eixo += direção; }} var container = document.getElementById ("contêiner"); container.innerhtml += pontos; } var OldPoint = null; // Obtenha a função da posição do mouse MousePosition (EV) {EV = EV || Window.Event; if (ev.pagex || ev.pagey) {return {x: ev.pagex, y: ev.pagey}; } var doc = document.documentElement, body = document.body; var pagex = event.clientX + (doc && doc.ScrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientleft || body && body.clientleft || 0); var pagey = event.clienty + (doc && doc.Scrolltop || body && body.scrolltop || 0) - (doc && doc.clienttop || body && body.clienttop || 0); return {x: PageX, y: Pagey};} Função Registro Point (ev) {var Point = MousePosition (EV); if (OldPoint! = null) {line (OldPoint.x, OldPoint.Y, Point.X, Point.Y); } OldPoint = Point;} </SCRIPT> </head> <body> <div id = "contêiner" onclick = "Record Point (event);"> </div> <script type = "text/javascript"> // line (19,19,22,300); </script> </body> </html>