Object tag and Javascript access

admin

Administrator
Staff member
Problem description:

In my main page (a.htm) I have set a value to a javascript variable (flag).

I have also created an object element of html type so that I can load an html document (b.htm) in it.

<object type='text/html' border='0' style='position:absolute;z-index:2;top:50px;left:0px;width:100%;height:100%' data=http://www.webdeveloper.com/forum/archive/index.php/"b.htm" id='canvas'></object>

In the second page (b.htm) I want to be able to load that variable (flag).

How do I do that ? I always get undefined error.

So the question it, can I have access to the javascript code/variables of the page that object type=html is created in from within the page loaded in that object tag ? If so how ?

I've tried everything I could possibly think of.

Any help ?

I am looking forward to receiving your reply.

Best Regards to all

I am attaching the code I've created:

------- a.htm------



<HTML>
<HEAD>
<TITLE>Example</TITLE>


<script type="text/javascript">
<!--
var flag="Readed and Rendered";

document.write(flag)
//-->
</script>
</HEAD>

<BODY>

<object type='text/html' border='0' style='position:absolute;z-index:2;top:50px;left:0px;width:100%;height:100%' data=http://www.webdeveloper.com/forum/archive/index.php/"b.htm" id='canvas'></object>


</BODY>
</HTML>


--------b.htm-------

<HTML>
<HEAD>
<TITLE>Popup Example</TITLE>

<BODY style="background:#666666;border:0px;overflow:hidden">

<script type="text/javascript">
<!--
document.write(parent.flag)
//-->
</script>


</font>
</BODY>
</HTML>
---------------------------------------
 
Back
Top