Hello everybody 

i added a small javascript in the svg code ...
from which we can draw a line in the canvas.
Can u help me ....it is not working
i even tried to note the no. of times the mouse clicks
by using mouseup and mousedown events 

here is the code: 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>
<svg onload="init(evt)"
xmlns="http://www.w3.org/2000/svg";
     xmlns:xlink="http://www.w3.org/1999/xlink"; 
     xml:space="preserve" width="130" height="200"
         viewBox="0 0 130 200"  >
<script type = "text/ecmascript"><![CDATA[
        
        var X1,Y1,X2,Y2; // global variables in javascript
         var mouseDown   = 0;
        var mouseUp     = 0;
        function init(evt) {
        if ( window.svgDocument == null )
            svgDocument = evt.target.ownerDocument;
         }
function updateStats() 
        {        
       
svgDocument.getElementById("mousedowns").firstChild.data
= "onmousedown = " + mouseDown;
       
svgDocument.getElementById("mouseups").firstChild.data
= "onmouseup = " + mouseUp;
           }
        function msDown(evt) {
         //on mouse down capture coordinates of start point
         X1 = evt.getClientX();
         Y1 = evt.getClientY();
        mouseDown ++;
         updateStats();
        }
        function msUp(evt) {
         // on mouse up capture coordinates of end point and
draw line
         X2 = evt.getClientX();
         Y2 = evt.getClientY();
         mouseUp++;
         updateStats();
               drawLine(X1,Y1,X2,Y2);
        }
        
 ]]></script>
 <!--handling mouse events on canvas-->
<g id="canvas" width="800" height="440"
onmousedown="msDown(evt)" onmouseup="msUp(evt)"/>
 <text x="10" y="125" id="mousedowns">onmousedown =
0</text>
 <text x="10" y="140" id="mouseups">onmouseup =
0</text>
 </svg>



Pls tell me my mistake

With Warm Regards
Ritu Garg



                
__________________________________________________________
Yahoo! India Answers: Share what you know. Learn something new
http://in.answers.yahoo.com/


-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/svg-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to