Loading ...
Sorry, an error occurred while loading the content.

SVG ASV - getting embedded attributes

Expand Messages
  • kashivis
    Hi, I have been trying to access embedded SVG element attributes. The script works on FF and Chrome. It does not work on ASV 3.3 +IE 6 ... which, unfortunately
    Message 1 of 6 , Jun 2, 2010
    • 0 Attachment
      Hi,

      I have been trying to access embedded SVG element attributes. The script works
      on FF and Chrome. It does not work on ASV 3.3 +IE 6 ... which, unfortunately is
      my user's standard.

      I was wondering if there is an alternate way to access DOM element array, as I
      would like to make change display attributes based on a form selection.

      Attached is a simplified HTML file with two SVGs embedded in it. The
      target_elements.id fails in IE+ASV.

      function init()
      {
      var svg_s = top.document.embeds; //array of embeds
      var target_tags = svg_s[0].getSVGDocument().getElementsByTagName("g"); //all
      group tags
      var target_elements = target_tags[0]; //the specific element within the tag
      var target_value = target_elements.id; //the id of the tag
      alert("ID is: "+target_value);
      }

      Thanks and Regards,
      Kashi

      P.S. The zipped sample file is here
      http://f1.grp.yahoofs.com/v1/sDkGTNSfNAE2gEUSCW8v98IGZ13uiDEKPtILR99yi_O0aSXC9U2P_LNN5PG1xXFqRxojd7S4-WqHjEvXADWVCTEYPlqY0A/ASV3/testab.zip
    • G. Wade Johnson
      On Wed, 02 Jun 2010 11:32:59 -0000 ... If I remember correctly, ASV requires that you use: var target_value = target_elements.getAttribute( id ); G. Wade --
      Message 2 of 6 , Jun 2, 2010
      • 0 Attachment
        On Wed, 02 Jun 2010 11:32:59 -0000
        "kashivis" <kashivis@...> wrote:

        > Hi,
        >
        > I have been trying to access embedded SVG element attributes. The
        > script works on FF and Chrome. It does not work on ASV 3.3 +IE 6 ...
        > which, unfortunately is my user's standard.
        >
        > I was wondering if there is an alternate way to access DOM element
        > array, as I would like to make change display attributes based on a
        > form selection.
        >
        > Attached is a simplified HTML file with two SVGs embedded in it. The
        > target_elements.id fails in IE+ASV.
        >
        > function init()
        > {
        > var svg_s = top.document.embeds; //array of embeds
        > var target_tags =
        > svg_s[0].getSVGDocument().getElementsByTagName("g"); //all group tags
        > var target_elements = target_tags[0]; //the specific element within
        > the tag var target_value = target_elements.id; //the id of the tag
        > alert("ID is: "+target_value);
        > }
        >
        > Thanks and Regards,
        > Kashi

        If I remember correctly, ASV requires that you use:

        var target_value = target_elements.getAttribute( 'id' );

        G. Wade
        --
        If you like laws and sausages, you should never watch either one being
        made. -- Otto von Bismarck
      • kashivis
        Hi Wade, var target_value = target_elements.getAttribute( id ); ...doesn t work. The error says undefined is null or not an object Is there any other method?
        Message 3 of 6 , Jun 2, 2010
        • 0 Attachment
          Hi Wade,

          var target_value = target_elements.getAttribute('id');

          ...doesn't work.

          The error says 'undefined' is null or not an object

          Is there any other method?

          Regards,
          Kashi

          --- In svg-developers@yahoogroups.com, "G. Wade Johnson" <gwadej@...> wrote:
          >
          > On Wed, 02 Jun 2010 11:32:59 -0000
          > "kashivis" <kashivis@...> wrote:
          >
          > > Hi,
          > >
          > > I have been trying to access embedded SVG element attributes. The
          > > script works on FF and Chrome. It does not work on ASV 3.3 +IE 6 ...
          > > which, unfortunately is my user's standard.
          > >
          > > I was wondering if there is an alternate way to access DOM element
          > > array, as I would like to make change display attributes based on a
          > > form selection.
          > >
          > > Attached is a simplified HTML file with two SVGs embedded in it. The
          > > target_elements.id fails in IE+ASV.
          > >
          > > function init()
          > > {
          > > var svg_s = top.document.embeds; //array of embeds
          > > var target_tags =
          > > svg_s[0].getSVGDocument().getElementsByTagName("g"); //all group tags
          > > var target_elements = target_tags[0]; //the specific element within
          > > the tag var target_value = target_elements.id; //the id of the tag
          > > alert("ID is: "+target_value);
          > > }
          > >
          > > Thanks and Regards,
          > > Kashi
          >
          > If I remember correctly, ASV requires that you use:
          >
          > var target_value = target_elements.getAttribute( 'id' );
          >
          > G. Wade
          > --
          > If you like laws and sausages, you should never watch either one being
          > made. -- Otto von Bismarck
          >
        • G. Wade Johnson
          On Thu, 03 Jun 2010 03:28:45 -0000 ... Then we need to back up. This is saying that target_elements does not have a value. Are you sure that target_tags has
          Message 4 of 6 , Jun 3, 2010
          • 0 Attachment
            On Thu, 03 Jun 2010 03:28:45 -0000
            "kashivis" <kashivis@...> wrote:

            > Hi Wade,
            >
            > var target_value = target_elements.getAttribute('id');
            >
            > ...doesn't work.
            >
            > The error says 'undefined' is null or not an object
            >
            > Is there any other method?

            Then we need to back up. This is saying that target_elements does not
            have a value. Are you sure that 'target_tags' has the right value?

            I would normally call alert() on each piece working backward to find
            which object is the first one that's not right. At that point, you are
            probably assuming something that ASV had not done correctly.

            Sorry I couldn't be more help.
            G. Wade


            > Regards,
            > Kashi
            >
            > --- In svg-developers@yahoogroups.com, "G. Wade Johnson" <gwadej@...>
            > wrote:
            > >
            > > On Wed, 02 Jun 2010 11:32:59 -0000
            > > "kashivis" <kashivis@...> wrote:
            > >
            > > > Hi,
            > > >
            > > > I have been trying to access embedded SVG element attributes. The
            > > > script works on FF and Chrome. It does not work on ASV 3.3 +IE
            > > > 6 ... which, unfortunately is my user's standard.
            > > >
            > > > I was wondering if there is an alternate way to access DOM element
            > > > array, as I would like to make change display attributes based on
            > > > a form selection.
            > > >
            > > > Attached is a simplified HTML file with two SVGs embedded in it.
            > > > The target_elements.id fails in IE+ASV.
            > > >
            > > > function init()
            > > > {
            > > > var svg_s = top.document.embeds; //array of embeds
            > > > var target_tags =
            > > > svg_s[0].getSVGDocument().getElementsByTagName("g"); //all group
            > > > tags var target_elements = target_tags[0]; //the specific element
            > > > within the tag var target_value = target_elements.id; //the id of
            > > > the tag alert("ID is: "+target_value);
            > > > }
            > > >
            > > > Thanks and Regards,
            > > > Kashi
            > >
            > > If I remember correctly, ASV requires that you use:
            > >
            > > var target_value = target_elements.getAttribute( 'id' );
            > >
            > > G. Wade
            > > --
            > > If you like laws and sausages, you should never watch either one
            > > being made. -- Otto von
            > > Bismarck
            > >
            >
            >


            --
            Don't kill him!! If you kill him, he won't learn nothin'!
            -- The Riddler, "Batman Forever"
          • israel_eisenberg
            Hi Kashi, Hi Wade, Any reference you make to get_group[n] change to get_group.item(n) Regards, Israel
            Message 5 of 6 , Jun 3, 2010
            • 0 Attachment
              Hi Kashi, Hi Wade,

              Any reference you make to get_group[n] change to get_group.item(n)

              Regards,
              Israel
            • kashivis
              Thanks Israel, Wade, get_group.item(n) instead of get_group[n] worked!!! Rgds, Kashi
              Message 6 of 6 , Jun 6, 2010
              • 0 Attachment
                Thanks Israel, Wade,

                get_group.item(n) instead of get_group[n] worked!!!

                Rgds,
                Kashi

                --- In svg-developers@yahoogroups.com, "israel_eisenberg" <owlgems@...> wrote:
                >
                > Hi Kashi, Hi Wade,
                >
                > Any reference you make to get_group[n] change to get_group.item(n)
                >
                > Regards,
                > Israel
                >
              Your message has been successfully submitted and would be delivered to recipients shortly.