Greetings-

I am trying to construct an SVG project which will be viewable by as
many web browsers as possible (the three mentioned in the subject
heading at a minimum). 'Embedding' an SVG is not too tricky, I would
use conditional IE statements to use 'embed' for IE and !IE statements
for Opera and Firefox to use 'object'. The third option would be to
use an iframe.

However things get complicated when I bring up that I also want to use
a form to turn on and off layer visibility.

This works in FireFox and Internet Explorer so long as I use 'embed'.
If I begin using a combination, or if I use object, or iframe it
ceases to work. 

The only solution I've been able to come up with so far with the
wonderful help of Doug Schepers is to use SVG with JavaScript in the
code itself. This isn't as clean a solution as I have with my current
method which needs no code in the SVG, it can read the SVG so long as
it knows its 'name'.

Current code:

<script type="text/javascript">
                function svg_elem(checkbox, element_name){
                        // For each element, get the element's style object, 
then set
                        // its visibility according to the state of the 
checkbox.
                        var svgobj =
document.embeds['features'].getSVGDocument().getElementById(element_name);
                        if (!checkbox.checked){
                                // Hide layer.
                                svgobj.setAttributeNS(null,'style', 
'display:none;fill-rule:evenodd');
                        } else {
                                // Show layer.
                                svgobj.setAttributeNS(null,'style',
'display:inline;fill-rule:evenodd');
                        }
                }
</script>

And for the form:

<form name="tickbox_form" action="" />
<p>Layer Visibility<input type="checkbox" value=""
onclick="svg_elem(this,'layername')" />Layername

Any ideas? Do I need to bite the bullet and insert code into my SVG?



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