ReferencError: Parent is not defined

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mike

    ReferencError: Parent is not defined

    I have a html page that has an inframe very similiar to the one Jim Ley
    put out at:


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Test by TM 08/03</title>
    </head>
    <body>

    <iframe name="kreise" src="kreise.svg " width="500" height="100"
    frameborder="0" >
    content for browsers without SVG access ...
    </iframe>

    </html>

    The only difference is that the user is clicking on a link in
    kreise.svg to get the parent document. I get "ReferencEr ror: Parent is
    not defined"

    kreise.svg would look like:

    <svg width="1024px" height="626px" onload="initsvg (evt);" viewBox="0 0
    1024 626" preserveAspectR atio="none" xmlns="http://www.w3.org/2000/svg"
    xmlns:xlink="ht tp://www.w3.org/1999/xlink"
    xmlns:a3="http://ns.adobe.com/AdobeSVGViewerE xtensions/3.0/"
    a3:scriptImplem entation="Adobe ">
    <title>Graphi c</title>
    <defs>
    <script language="JavaS cript">
    <![CDATA[
    var svgObj;
    function initsvg(evt)
    {
    if ( window.svgDocum ent == null )
    {
    svgDocument = evt.target.owne rDocument;
    }
    svgObj = svgDocument.doc umentElement;
    }
    function close_graphic(e vt)
    {
    var obj;
    obj=parent.fram es["kreise"];
    alert(obj);

    //parent.document .getElementById ('kreise').styl e.visibility='h idden';
    }
    ]]>
    </script>
    </defs>
    <a onclick="close_ graphic(evt);">
    <text x="35" y="35" font-family="Arial" font-size="20" fill="#ff0000"
    pointer-events="all">Cl ose</text>
    </a>
    </svg>

    Anyone have any idea why this does not function?

    Mike

  • mike

    #2
    Re: ReferencError: Parent is not defined

    I guess no body knows ....

    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: ReferencError: Parent is not defined

      mike wrote:
      [color=blue]
      > I have a html page that has an inframe very similiar to the one Jim Ley
      > put out at:
      > http://jibbering.com/2003/8/iframetest.html
      >
      > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">[/color]

      Their should be a system identifier to force Standards Compliance Mode.
      [color=blue]
      > [...]
      > <iframe name="kreise" src="kreise.svg " width="500" height="100"
      > frameborder="0" >
      > content for browsers without SVG access ...
      > </iframe>
      > [...]
      > The only difference is that the user is clicking on a link in
      > kreise.svg to get the parent document. I get "ReferencEr ror:
      > Parent is not defined"[/color]

      I think that really is "ReferenceError : parent is not defined".
      [color=blue]
      > kreise.svg would look like:
      > [...]
      > function initsvg(evt)
      > {
      > if ( window.svgDocum ent == null )
      > {
      > svgDocument = evt.target.owne rDocument;
      > }
      > svgObj = svgDocument.doc umentElement;
      > }
      > function close_graphic(e vt)
      > {
      > var obj;
      > obj=parent.fram es["kreise"];
      > alert(obj);
      > [...]
      > Anyone have any idea why this does not function?[/color]

      `parent' is a known property of Window objects. You are assuming falsely
      that the object referred to by `window' in some HTML DOMs necessarily
      refers to the Global Object, and that the Global Object in the SVG DOM
      is a Window object. Try `window.parent' instead.


      PointedEars

      Comment

      • mike

        #4
        Re: ReferencError: Parent is not defined

        I tried:

        var obj;
        obj=window.pare nt;
        alert(obj);

        and the error message is:

        "uncaught exception: [SOMException 3: Parameter type mismatch: 1]"

        Mike

        Comment

        • Thomas 'PointedEars' Lahn

          #5
          Re: ReferencError: Parent is not defined

          mike wrote:
          [color=blue]
          > I tried:
          >
          > var obj;
          > obj=window.pare nt;
          > alert(obj);
          >
          > and the error message is:
          >
          > "uncaught exception: [SOMException 3: Parameter type mismatch: 1]"[/color]

          Please quote the minimum of what you are replying to and provide attribution
          of quoted material.
          <URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1P ost>
          <URL:http://www.safalra.com/special/googlegroupsrep ly/>

          Well, then you will have to find other means in the DOM of the SVG context
          you are working in (which UA, which plugin?), or there is simply no means
          to refer to the "parent" window in that DOM.


          PointedEars

          Comment

          • mike

            #6
            Re: ReferencError: Parent is not defined

            I found an example of where I would define what looks like a link into
            the document. Instead of using an iframe they used an <embed> tag. I
            included this in my example below as well as the js definition of
            htmldocument

            <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
            <html>
            <head>
            <title>Test by TM 08/03</title>
            </head>
            <body>
            <SCRIPT language=javasc ript>
            var htmldocument=do cument
            </SCRIPT>
            <iframe name="kreise" src="kreise.svg " width="500" height="100"
            frameborder="0" >
            content for browsers without SVG access ...
            </iframe>
            <embed width="200" height="100" src="controls.s vg">
            </html>

            Then in the controls.svg there is an init function like:

            <script><![CDATA[
            var svgdoc='',root= '';
            function init(evt)
            {
            svgdoc=htmldocu ment.embeds[0].getSVGDocument ();
            root=svgdoc.fir stChild();
            }
            ]]></script>

            So, for my use in an iframe it seems like I would use:

            svgdoc=htmldocu ment.frames[0].getSVGDocument ();

            except I get: "ReferenceError : htmldocument is not defined"

            Any thought on that?

            Comment

            • mike

              #7
              Re: ReferencError: Parent is not defined

              crapola.... I guess those methods are just not there.

              Comment

              • Jasen Betts

                #8
                Re: ReferencError: Parent is not defined

                On 2005-12-22, mike <hillmw@charter .net> wrote:[color=blue]
                > I tried:
                >
                > var obj;
                > obj=window.pare nt;
                > alert(obj);
                >
                > and the error message is:
                >
                > "uncaught exception: [SOMException 3: Parameter type mismatch: 1]"[/color]

                sounds about right. what was it supposed to do?

                Bye.
                Jasen

                Comment

                • Jasen Betts

                  #9
                  Re: ReferencError: Parent is not defined

                  On 2005-12-22, mike <hillmw@charter .net> wrote:[color=blue]
                  > crapola.... I guess those methods are just not there.[/color]

                  I don't think window implements the value property...
                  (and so there's nothing for the alert to print)

                  upto the alert your code is fine.

                  --

                  Bye.
                  Jasen

                  Comment

                  • mike

                    #10
                    Re: ReferencError: Parent is not defined

                    Jason,

                    I'm just trying to get to the window functions so I can open and close
                    some windows but I can't get there from in a document with this
                    heirarachy:

                    document | iframe | svgdoc

                    Mike

                    Comment

                    Working...