By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,044 Members | 1,248 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,044 IT Pros & Developers. It's quick & easy.

ReferencError: Parent is not defined

P: n/a
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.vis ibility='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

Dec 21 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
I guess no body knows ....

Dec 22 '05 #2

P: n/a
mike wrote:
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
Dec 22 '05 #3

P: n/a
I tried:

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

and the error message is:

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

Mike

Dec 22 '05 #4

P: n/a
mike wrote:
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
Dec 22 '05 #5

P: n/a
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?

Dec 22 '05 #6

P: n/a
crapola.... I guess those methods are just not there.

Dec 22 '05 #7

P: n/a
On 2005-12-22, mike <hi****@charter.net> wrote:
I tried:

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

and the error message is:

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


sounds about right. what was it supposed to do?

Bye.
Jasen
Dec 23 '05 #8

P: n/a
On 2005-12-22, mike <hi****@charter.net> wrote:
crapola.... I guess those methods are just not there.


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
Dec 23 '05 #9

P: n/a
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

Dec 24 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.