zoukankan      html  css  js  c++  java
  • 利用 wz_jsgraphics.js 画线

    参考:http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm
    =====================
    <html>
    <head>
        <title>利用 wz_jsgraphics.js 画线</title>
        <script src="wz_jsgraphics.js" type="text/javascript"></script>
    <script language=javascript>

    var IsDrawLine = "0";
    //
    var StartX = 0;
    var StartY = 0;
    var EndX = 0;
    var EndY = 0;

    var jgdiv1;

    function fn_WantDrawLine()
    {
        IsDrawLine = "1";
    }

    function fn_onmousedown()
    {
        if(IsDrawLine=="1")
        {
            //起点
            StartX = event.x;
            StartY = event.y;
            document.all.Text1.value = StartX;
            document.all.Text2.value = StartY;
            //
            jgdiv1.drawLine(StartX,StartY,StartX,StartY);
            jgdiv1.paint();
        }
    }

    function fn_onmousemove()
    {
        if(IsDrawLine=="1")
        {
            if(StartX!=0)
            {
                //终点
                EndX = event.x;
                EndY = event.y;
                document.all.Text3.value = EndX;
                document.all.Text4.value = EndY;
    //            //
    //            jgdiv1.drawLine(StartX,StartY,EndX,EndY);
    //            jgdiv1.paint();
            }
        }
    }

    function fn_onmouseup()
    {
        if(IsDrawLine=="1")
        {
            //画线
            jgdiv1.drawLine(StartX,StartY,EndX,EndY);
            jgdiv1.paint();
            //
            IsDrawLine = "0";
            document.all.Text1.value = "";
            document.all.Text2.value = "";
            document.all.Text3.value = "";
            document.all.Text4.value = "";
            StartX = 0;
            StartY = 0;
        }
    }

    document.onmousedown = fn_onmousedown;
    document.onmousemove = fn_onmousemove;
    document.onmouseup = fn_onmouseup;

    </SCRIPT>

    </head>
    <body>
        <form id="form1" runat="server">
            <input id="Button1" type="button" onclick="fn_WantDrawLine();" value="画线" />
            <input id="Text1" type="text" /><input id="Text2" type="text" />
            <input id="Text3" type="text" /><input id="Text4" type="text" />
           
            <div id="div1" style="400; height:400; border:solid 1px #1C5E55;">
            <script>
                jgdiv1 = new jsGraphics("div1");
                jgdiv1.setColor("#cc0000");
                jgdiv1.setStroke(10);
            </script>
            </div>
        </form>
    </body>
    </html>

  • 相关阅读:
    Atitit. 查找linux 项目源码位置
    Atitit.用户权限服务 登录退出功能
    Atitit.js javascript的rpc框架选型
    Atitit.php  nginx页面空白 并返回500的解决
    Atitit .linux 取回root 密码q99
    Atitit.报名模块的管理
    Atitit.基于时间戳的农历日历历法日期计算
    Atitit.excel导出 功能解决方案 php java C#.net版总集合.doc
    我的博客开通了
    (转)列举ASP.NET 页面之间传递值的几种方式
  • 原文地址:https://www.cnblogs.com/pricks/p/1669728.html
Copyright © 2011-2022 走看看