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

Re: Issue access script in SVG and Frameset

Expand Messages
  • Francis Hemsher
    ... Hi Zed, Try this: whateverNeedsToGoHere=document.frames.myFrameId also, for the function in the SVG add: parent.myFunction=myFunction in the SVG script.
    Message 1 of 5 , Jun 25, 2009
    • 0 Attachment
      --- In svg-developers@yahoogroups.com, "zedkineece" <zedkineece@...> wrote:
      >
      > I have been racking my brain trying to call a script from an HTML page to a script contained in an SVG. From what I have read, this is doable, but I can't seem to make it work.
      >
      > I have a frameset as follows:
      >
      > <FRAMESET ROWS="70%,*">
      > <FRAME id="part_item" SRC="embed.htm" TITLE="part_item" noscroll frameborder="1" bordercolor="#666666">
      > <FRAME idE="mpl" SRC="FS012515.htm" TITLE="Content" frameborder="1" bordercolor="#666666">
      > </FRAMESET>
      >
      > embed.htm:
      > <body>
      > <embed name="figure" width="95%" height="95%" type="image/svg" src="FS012515_result.svg"></embed>
      > </body>
      >
      > FS012515.htm:
      > <tr id="_3" onMouseOver="parent.whateverNeedsToGoHere.getHighlight('3', 1, 'red');">
      >
      > script contained in FS01215_result.svg:
      >
      > function getHighlight(id, mode, color)
      > {
      > var element = docSVG.getElementById(id);
      > var fill = element.getAttribute("fill");
      > if (fill == "black")
      > {
      > fill = "";
      > }
      > var defaultcolor = "#FF9900";
      > switch (mode)
      > {
      > case 0:
      > color = fill || defaultcolor;
      > break;
      > case 1:
      > color = ((fill == defaultcolor) ? "" : fill);
      > break;
      > case 2:
      > color = ((fill == color) ? defaultcolor : color);
      > break;
      > }
      > element.setAttribute("fill", color || "black");
      > element.setAttribute("stroke", color || "black");
      > }
      >
      > Can anyone provide some guidance on how to call this script from a separate HTML file contained in a different frame?
      >
      > thanks,
      >
      > zed
      >

      Hi Zed,
      Try this:
      whateverNeedsToGoHere=document.frames.myFrameId
      also,
      for the function in the SVG add: parent.myFunction=myFunction
      in the SVG script.
      Regards,
      Francis
    Your message has been successfully submitted and would be delivered to recipients shortly.