Hi John,
  For Firefox you need to use getAttributeNS and setAttributeNS 
instead of getAttribute and setAttribute and may be make some more 
changes. See 
http://jwatt.org./svg/authoring/
for more details. Cheers, Samy

--- In [email protected], "johnbaronreid1972" 
<[EMAIL PROTECTED]> wrote:
>
> Hi,
> 
> I can't get the following code to work in firefox. ASV6 seems to 
have
> no problems. I imagine I've got something to do with namespaces 
wrong
> but I can't figure out what it is. Under firefox I get the following
> error when getBBox() is called:
> 
> Error: uncaught exception: [Exception... "Component returned failure
> code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMSVGLocatable.getBBox]" 
> nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame ::
> file:///C:/Dev/MyProjects/Bio/svg/bbox_test.svg :: on_event :: line
> 30"  data: no]
> 
> Any help would be much appreciated. I looked at
> http://wiki.svg.org/GetBBox and tried to follow the advice there.
> 
> Thanks,
> John.
> 
> 
> 
> The svg is:
> 
> <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
> <svg 
>       xmlns="http://www.w3.org/2000/svg"; 
>       baseProfile="full" 
>       onload="init(evt);" 
>       preserveAspectRatio="xMidYMid" 
>       version="1.1" 
>       viewBox="0 0 150 130" 
>       xmlns:ev="http://www.w3.org/2001/xml-events"; 
>       xmlns:xlink="http://www.w3.org/1999/xlink";>
> 
>   <script type="text/javascript"><![CDATA[
>       var svgNS = "http://www.w3.org/2000/svg";;
>       var doc = null;
>       var root = null;
> 
>       function init(evt)
>       {
>               doc = evt.target.ownerDocument;
>               root = doc.documentElement;
>       };
>       
>       function on_event()
>       {
>               var hit_info = doc.getElementById('info');
>               if( null == hit_info ) alert('Could not find: info');
>               else {
>                       var back = doc.getElementById('back');
>                       if (toggle_display(hit_info)) {
>                               var outline = hit_info.getBBox();
>                               back.setAttribute('x', outline.x - 
1.5);
>                               back.setAttribute('y', outline.y - 
1.5);
>                               back.setAttribute('width', 
outline.width + 3);
>                               back.setAttribute('height', 
outline.height + 3);
>                               back.setAttribute('display', 
'inline');
>                       } else {
>                               back.setAttribute('display', 'none');
>                       }
>               }
>       }
>       
>       function toggle_display(el)
>       {
>               if ('none' == el.getAttribute('display')) {
>                       el.setAttribute('display', 'inline');
>                       return true;
>               } else {
>                       el.setAttribute('display', 'none');
>                       return false;
>               }
>       };
> ]]></script>
> 
>       <circle id="hit" cx="50" cy="50" fill="white" 
onclick="on_event()"
> r="2" stroke="black" stroke-width="0.3"/>
>       <rect id="back" display="none" fill="lightgray" rx="0.3"
> stroke="lightgray" stroke-width="0.3"/>
>       <rect id="info" display="none" fill='green' x='5' y='5' 
width='20'
> height='10'/>
> </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