What I do is put all my javascript into the containing HTML page, not in 
the SVG documents.  This makes it much easier to debug!

The only code you should put in your SVG document is the minimum 
javascipt necessary to parse your Ajaxed code.  Thus:

(In main document:)
<script type="text/javascript">
var ParseFunc = null;      // global variable which will hold reference 
to svgdoc parse function
</script>
<html>

<!-- somewhere here you make an ajax call to get your new SVG content -->
<script type="text/javascript">
ParseFunc('targetNode', newContent);      // this inserts new content as 
a child of targetNode node
</script>
...
</html>

(in svg code:)
<svg id="SVGDoc" onload="initmap(evt)" ...>
<script type="text/javascript">
<![CDATA[
    function initmap(evt)
    {
       top.ParseFunc = parseFunc;      // define a hook to following 
function
    }

    function ParseFunc(where, what)
    {
       var node = parseXML(what, document);
       document.getElementById(where).appendChild(node);
       return node;      // not necessary to do this, but might want to 
manipulate tree afterwards
    }
</script>
<g id='targetNode'></g>
...
</svg>

When the svg document loads, it calls initmap(), which sets a reference 
in the parent HTML that is callable later.

achio_84 wrote:

> Thanks for your reply...
> I'd get what you mean.. But, where should I write my javascript to
> get the 2nd svg file's content? Is that in the 2nd file or 1st svg
> file?
> And, if I write my javascript in the 2nd file, how can I pass the
> content to the 1st file? I mean how can my javascript "know" that my
> destination is the 1st file? Is that using function getURL() and
> postURL()? Can you give me some example of coding?
>
> Thanks...
>
> Regards,
> achio.
>
> --- In svg-developers@yahoogroups.com 
> <mailto:svg-developers%40yahoogroups.com>, Darryl Watson <[EMAIL PROTECTED]>
> wrote:
> >
> > Well, you need to write some javascript to retrieve the 2nd SVG
> file and
> > then call parseXML() on that content, which will give you back a
> > document element, which you can then insert into your first SVG
> document
> > wherever you need it
> >
> > achio_84 wrote:
> >
> > > Hi all....
> > > Can anyone please help me with this problem?
> > > I have 2 svg files and I want to pass the content in 1 svg file to
> > > another svg file during runtime. How can I do that?
> > >
> > > I search the web for the solution and I found that it can be done
> by
> > > using nested svg file, which mean to include svg file within
> another
> > > svg file. But this is not what I want. I do not want to embed svg
> file
> > > inside the other svg file. I wonder if there is another solution
> to
> > > pass the content to other svg files?
> > >
> > > Hope to receive reply soon....
> > > Thanks.
> > >
> > > New Message Search
> > >
> > > Find the message you want faster. Visit your group to try out the
> > > improved message search.
> > >
> > > Share feedback on the new changes to Groups
> > >
> <http://us.lrd.yahoo.com/_ylc=X3oDMTJtZmFsZjZhBF9TAzk3MzU5NzE0BF9wAzIE 
> <http://us.lrd.yahoo.com/_ylc=X3oDMTJtZmFsZjZhBF9TAzk3MzU5NzE0BF9wAzIE>
> Z3JwSWQDMTI5ODQyMQRncnBzcElkAzE2MDEwMzAzODkEc2VjA25jbW9kBHNsawNmZGJjaw
> RzdGltZQMxMTUyNjc3MzE2;_ylg=1/SIG=11im36rmb/**http%
> 3a//surveylink.yahoo.com/wix/p1412899.aspx>
> > >
> > > Recent Activity
> > >
> > > *
> > > 13
> > > New Members
> > > <http://groups.yahoo.com/group/svg- 
> <http://groups.yahoo.com/group/svg->
> developers/members;_ylc=X3oDMTJma3JlZ2VlBF9TAzk3MzU5NzE0BGdycElkAzEyOT
> g0MjEEZ3Jwc3BJZAMxNjAxMDMwMzg5BHNlYwN2dGwEc2xrA3ZtYnJzBHN0aW1lAzExNTI2
> NzczMTY->
> > >
> > > Visit Your Group
> > > <http://groups.yahoo.com/group/svg- 
> <http://groups.yahoo.com/group/svg->
> developers;_ylc=X3oDMTJlaDQyZDBsBF9TAzk3MzU5NzE0BGdycElkAzEyOTg0MjEEZ3
> Jwc3BJZAMxNjAxMDMwMzg5BHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTE1MjY3NzMxNg--
> >
> > >
> > > .
> > >
> > >
> >
>
>  




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Great things are happening at Yahoo! Groups.  See the new email design.
http://us.click.yahoo.com/TISQkA/hOaOAA/yQLSAA/1U_rlB/TM
--------------------------------------------------------------------~-> 

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