ReferencError: Parent is not defined

M

mike

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">
<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 "ReferencError: Parent is
not defined"

kreise.svg would look like:

<svg width="1024px" height="626px" onload="initsvg(evt);" viewBox="0 0
1024 626" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:a3="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
a3:scriptImplementation="Adobe">
<title>Graphic</title>
<defs>
<script language="JavaScript">
<![CDATA[
var svgObj;
function initsvg(evt)
{
if ( window.svgDocument == null )
{
svgDocument = evt.target.ownerDocument;
}
svgObj = svgDocument.documentElement;
}
function close_graphic(evt)
{
var obj;
obj=parent.frames["kreise"];
alert(obj);

//parent.document.getElementById('kreise').style.visibility='hidden';
}
]]>
</script>
</defs>
<a onclick="close_graphic(evt);">
<text x="35" y="35" font-family="Arial" font-size="20" fill="#ff0000"
pointer-events="all">Close</text>
</a>
</svg>

Anyone have any idea why this does not function?

Mike
 
T

Thomas 'PointedEars' Lahn

mike said:
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">

Their should be a system identifier to force Standards Compliance Mode.
[...]
<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 "ReferencError:
Parent is not defined"

I think that really is "ReferenceError: parent is not defined".
kreise.svg would look like:
[...]
function initsvg(evt)
{
if ( window.svgDocument == null )
{
svgDocument = evt.target.ownerDocument;
}
svgObj = svgDocument.documentElement;
}
function close_graphic(evt)
{
var obj;
obj=parent.frames["kreise"];
alert(obj);
[...]
Anyone have any idea why this does not function?

`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
 
M

mike

I tried:

var obj;
obj=window.parent;
alert(obj);

and the error message is:

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

Mike
 
T

Thomas 'PointedEars' Lahn

mike said:
I tried:

var obj;
obj=window.parent;
alert(obj);

and the error message is:

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

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#ps1Post>
<URL:http://www.safalra.com/special/googlegroupsreply/>

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
 
M

mike

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=javascript>
var htmldocument=document
</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.svg">
</html>

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

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

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

svgdoc=htmldocument.frames[0].getSVGDocument();

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

Any thought on that?
 
M

mike

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top