Ok, got the script working with EMBEDs (just for the notes):
<script type="text/javascript">
// function to show line of any selected country
function showLine(id)
{
svgDocument = document.embeds["svg_object"].getSVGDocument();
delta = svgDocument.getElementById("g" + id);
delta.setAttribute("visibility", "visible"); //add
behaviour
}
</script>
Still wondering about the OBJECT/EMBED issue. And the script does not work with
the OBJECT...
Stef
On Dec 27, 2011, at 12:04 PM, Stefan Schwarzer wrote:
> Hi,
>
> I am wondering why in my case the OBJECT does not work when I call the cached
> SVG file. And the EMBED does not work when I call the PHP file.
>
> And even worse, my script to highlight a country line does work with OBJECT,
> but not with EMBED:
>
> <!-- highlight countries -->
> <script type="text/javascript">
> // access SVG object
> var a = document.getElementById("svg_object");
>
> //it's important to add an load event listener to the
> object, as it will load the svg doc asynchronously
> a.addEventListener("load",function()
> {
> var svgDoc = a.contentDocument; //get the inner
> DOM of svg_object
> var delta = svgDoc.getElementById("g332");
> //get the inner element by id
> delta.setAttribute("visibility", "visible");
> //add behaviour
> },false);
> </script>
>
> Any tip what I can do about it? Thanks for any suggestions.
>
> Stef
>
>>
>>
>> --- In [email protected], Jeff Schiller <codedread@...> wrote:
>> >
>> > It's not clear to me why you need to use embed and not object for your
>> > cached version.
>> >
>> > Can you have your PHP file check for the existence of the cached SVG file
>> > on your server? If not present, generate the file. If present, send that
>> > file's contents to the client.
>> >
>> > Jeff
>> >
>> > On Tue, Dec 20, 2011 at 6:55 AM, luftikus_143 <st.schwarzer@...>wrote:
>> >
>> > > **
>> > >
>> > >
>> > > Hi there,
>> > >
>> > > I would like to cache the SVG files which I generate via PHP. But it
>> > > seems
>> > > a bit difficult. When I first call the PHP file which produces the SVG, I
>> > > use the OBJECT element to display it on the website:
>> > >
>> > > <object id='svg_object' data='data_vis_bars_svg.php' type='image/svg+xml'
>> > > width='1150' height='500'></object>
>> > >
>> > > But when caching the SVG file, I can't use the OBJECT anymore, but must
>> > > use the EMBED instead:
>> > >
>> > > <embed id='svg_object' src='../etc/cache/data_vis_bars_svg.svg'
>> > > type='image/svg+xml' width='1150' height='500'></embed>
>> > >
>> > > Do you know of any intelligent workaround here? Not sure what I can do
>> > > about this...
>> > >
>> > > Thanks for any hints!
>> > >
>> > >
>> > >
>> >
>> >
>> > [Non-text portions of this message have been removed]
>> >
>>
>>
>
[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/
<*> 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:
[email protected]
[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/