Hi I'm starting using SVG with javaScript, I have a page that 
contains a embedded SVG and I use JavaScript to manipulate it, but 
when the page onload it shows an error "undefined" is null or isn't 
an object, and I don't know why, I hope you can help me thanks 

This is the svg code

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 12.0.0, SVG Export Plug-In . SVG 
Version: 6.00 Build 51448)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 
1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"; [
    <!ENTITY ns_svg "http://www.w3.org/2000/svg ">
    <!ENTITY ns_xlink "http://www.w3.org/1999/xlink";>
]>
<svg  version="1.1" xmlns=" http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; width="806" height="606" 
onload="inicio(evt)">

<!-- Definiendo Objetos -->
<defs>
<rect id="rectangulo" x="-100" y="-100" opacity="0.75" fill="white" 
stroke="#4AD" stroke-width="1" width="1" height="1" />   
<line id="linea" x1="-100" y1="-100" x2="-100" y2="-100" fill="none" 
stroke="#000000" stroke-width="2"  />
<circle id="circulo" cx="-100" cy="-100" r="1" fill="white" 
stroke="#000000" stroke-width="1" />
<ellipse id="elipse" cx="-100" cy="-100" rx="1" ry="1" fill="white" 
stroke="#000000" stroke-width="1" />
<polygon id="poligono" points="1,1 1,1 1,1" fill="white" 
stroke="#001100" stroke-width="1" />
</defs>

<!-- Area de trabajo -->
<rect id="background" x="2" y="2" fill="#FFFFFF" stroke="#000000" 
stroke-width="2" width="800" height="600" />

</svg>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<script language="JavaScript" type="text/javascript">
<!--
var svgDocument=null;
var evento=null;
var form;
function inicio(evt)
{
     evento = evt.getTarget(); //Here it marks the mistake
     //alert(evento);
    if(evento!= null)
    {

        svgDocument=evento.getOwnerDocument();
        svgRoot= svgDocument.documentElement;
    }   
    else
        alert("null");
}
....

</html>







-----
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