Thank you, Doug, I didn't know that.  Anyway, here is the code:
 
In the mouseClick function, the first assignment (var 
obj=evt.target.getNextSibling()) creates a text object, which is what it is 
supposed to do.  But the second assignment (obj=obj.getNextSibling()) returns 
null.  Hence the alert statement displays the message obj = null and the 
condition never gets executed.  It is supposed to work using ASVG3.  
Apparently, something to make it work in SVG is missing.  So my question is:

1)  Will the nested elements work to create an object hierarchy?  Or do I need 
to create a node tree?
 
P.S.  I am using Windows XP, Internet Explorer Version 
6.0.2900.2180.xpsp_sp2_rtm.040803-2158, and the latest version of Adobe SVG 
(just downloaded yesterday).  For some reason, JavaScript would not work and I 
found in my O'Reilly SVG Essentials book a reference to text/ecmascript that 
did mork.  How strange!
 
BTW, You experts should get on Experts Exchange, so that people you help can 
give you points!
 
Thanks again,
Patricia

////////////////////// Code Below /////////////////////////////

<svg
  width= "100%" height="100%" viewBox="0 0 900 500"
  onfiltered="init(evt)"
  xmlns="http://www.w3.org/2000/svg";
  xmlns:xlink="http://www.w3.org/1999/xlink";>

<script type="text/ecmascript">
<![CDATA[
var offsetY = 50;

function init(evt)
{
  refresh(svgDocument.getElementById("tasks") ,0);
}

function mouseClick(evt)
{
  var obj=evt.target.getNextSibling();
  if ((obj != null) && (obj.nodeName=="#text"))
  {
    obj=obj.getNextSibling();
  alert("obj = " + obj);
    if ((obj != null) && (obj.nodeName=="g"))
    {
      var attr = obj.getAttribute("visibility");
      if (attr == "hidden")
      {
        obj.setAttribute("visibility", "");
      }
      else
      {
        obj.setAttribute("visibility", "hidden");
      }
      offsetY = 0;
      refresh(svgDocument.getElementById("tasks") ,0)
    }
  }
}

function refresh(objGroup, level)
{
  var layer=objGroup.childNodes;
  var num=layer.length;
  for (var ix=0; ix < num; ix++)
  {
    var obj=layer.item(ix);
    if (obj.nodeName == "rect")
    {
      offsetX = level * 40;
      var transform = "translate(" + offsetX + " " + offsetY + ")";
      obj.setAttribute("transform", transform);
      offsetY = offsetY + 30;
    }
    else if (obj.nodeName == "g")
    {
      if (obj.getAttribute("visibility") != "hidden")
      {
        refresh(obj, level+1);
      }
    }
  }
}
// ]]>
</script>

<g id="tasks" onclick="mouseClick(evt)">
  <rect x="5" y="5" width="200" height="20" style="fill:blue"/>
  <rect x="5" y="5" width="200" height="20" style="fill:blue"/>
  <g>
    <rect x="5" y="5" width="200" height="20" style="fill:blue"/>
    <rect x="5" y="5" width="200" height="20" style="fill:blue"/>
  </g>
  <rect x="5" y="5" width="200" height="20" style="fill:blue"/>
  <rect x="5" y="5" width="200" height="20" style="fill:blue"/>
  <rect x="5" y="5" width="200" height="20" style="fill:yellow"/>
  <g>
    <rect x="5" y="5" width="200" height="20" style="fill:blue"/>
    <g>
      <rect x="5" y="5" width="200" height="20" style="fill:blue"/>
      <g>
        <rect x="5" y="5" width="200" height="20" style="fill:blue"/>
      </g>
    </g>
  </g>
  <rect x="5" y="5" width="200" height="20" style="fill:blue"/>
  <rect x="5" y="5" width="200" height="20" style="fill:red"/>
</g>
</svg>

 


Doug Schepers <[EMAIL PROTECTED]> wrote:
Hi, Patricia -

YahooGroups doesn't allow attachments. There is an upload area, but you're
probably better off posting it to a URL somewhere and sending a link.

Regards-
Doug

doug . schepers  @ vectoreal.com
www.vectoreal.com ...for scalable solutions.


Patricia LaRue wrote:
| 
| 
| Oops!  Here's the attachment.
| 



-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 


Yahoo! Groups Sponsor 
Get unlimited calls to

U.S./Canada


---------------------------------
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 the Yahoo! Terms of Service. 




[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/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