Hi Jonathan, 

  This didnt work either, at least, not entirely. the JScript 
console is cool.  Learn something new every day!!! Does IE have 
similar tool?  didnt see one.  Anyway, I've been looking around, and 
this appears to be a pretty common issue with FF.  The FF JScript 
console says "svgDocument has no properties."  From what I've read, 
this is common in FF when using getSVGDocument.  Whats more wierd, 
is I disabled the FF SVG and loaded Adobe, and thats where I saw the 
behavior.  For grins, this morning, I changed back to native SVG in 
FF, and all the sudden, it works using 

function onload=draw(), SVG native support, well-formed XML SVG 
file, and this line
svgDocument = document.embeds["SVGNAME"].getSVGDocument();

dosent work with Adobe loadedup. I'm doing some further testing, 
because FF is producing some very wierd "works when the sun is @ 45 
degress of the ....." kind of issues.  Its somewhat irritating that 
the browser I have some to love and defend, has such flaky issues it 
turns out.

BTW, here is a link to a site that has a example at the bottom 
trying to accomplish the same thing!  Dosent work on FF (although 
youl have to use adobe plugin, guess they arent using well-formed 
XML)
http://www.svgopen.org/2002/papers/hauser_wenz__scripting_svg/


I wanted to thank you for your time to respond to my question!
-j
--- In svg-developers@yahoogroups.com, Jonathan Watt <[EMAIL PROTECTED]> 
wrote:
>
> Hi,
> 
> The problem is likely that the SVG document hasn't yet loaded when 
draw() is
> called. Instead of calling it in the <script> element, call it 
onload. This
> should work I think:
> 
> <html>
> <body onload="draw();">
> <EMBED NAME="mydoc" WIDTH="800" HEIGHT="600" SRC="canvas.svg" />
> <script language="javascript">
> 
> var svgDocument;
> 
> function draw() {
>    var svgns = "http://www.w3.org/2000/svg";;
> 
>    svgDocument = this.document.mydoc.getSVGDocument();
>    var shape = svgDocument.createElementNS('
> http://www.w3.org/2000/svg','circle');
> 
>    shape.setAttributeNS(null, 'cx', 25);
>    shape.setAttributeNS(null, 'cy', 25);
>    shape.setAttributeNS(null, 'r',  20);
>    shape.setAttributeNS(null, 'fill', 'green');
>    svgDocument.documentElement.appendChild(shape);
> }
> 
> </script>
> <p>testing</p>
> </body>
> </html>
> 
> BTW, the JavaScript console is very useful in finding errors. See 
Tools >
> JavaScript Console from the menubar. getSVGDocument() will have 
returned
> null, so likely there was an error for the next line.
> 
> Regards,
> Jonathan
> 
> On 1/6/06, jaychambers <[EMAIL PROTECTED]> wrote:
> >
> > Can any tell me whay is going on here. I have no more hiar left 
to
> > pull out!!!!!
> >
> > I have a HTML page with some JScript in it, and a .svg.  The SVG 
look
> > like this:
> >
> > <svg version="1.1" baseProfile="full"
> > xmlns="http://www.w3.org/2000/svg";
> > xmlns:xlink="http://www.w3.org/1999/xlink";
> > xmlns:ev="http://www.w3.org/2001/xml-events";>
> > <rect x="1cm" y="1cm" width="1cm" height="1cm" />
> > </svg>
> >
> > simple eh`.  just draws a rect.  This work in both IE and 
FireFox (1.5).
> >
> > Now to the HTML page.  I want to use DOM/JScript to dynamically 
create
> > SVG elements .  HEre is my code:
> >
> > <html>
> > <body>
> > <EMBED NAME="mydoc" WIDTH="800" HEIGHT="600" SRC="/canvas.svg" />
> > <script language="javascript">
> > function draw() {
> > var svgns = "http://www.w3.org/2000/svg";;
> > svgDocument = this.document.mydoc.getSVGDocument();
> > var shape = svgDocument.createElementNS
('http://www.w3.org/2000/svg',
> > 'circle');
> >
> >     shape.setAttributeNS(null, 'cx', 25);
> >     shape.setAttributeNS(null, 'cy', 25);
> >     shape.setAttributeNS(null, 'r',  20);
> >     shape.setAttributeNS(null, 'fill', 'green');
> >     svgDocument.documentElement.appendChild(shape);
> > }
> > var blah = draw();
> > </script>
> > <p>testing</p>
> > </body>
> > </html>
> >
> > I just want to draw a friggin` circle dynamically!!!! Is this a 
bug in
> > Firefox, for a strictness issues with something inncorrect in 
the code.?
> >
> > Anyone, please help....
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > -----
> > 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
> >
> >
> >
> >
> >
> >
> >
> 
> 
> [Non-text portions of this message have been removed]
>






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

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