Hi to all I'm new in the forum and I have the following question:
can I share a javascript object between pages?
I'll explain my self, I have a page that contains two frames:
Currently I can call methods from frames, I was wandering if can retreive the all object, you can see in my example, I can call to the method "CallToit()" that calls to the method CallME() that is defined in the frame2 and return a property of the object, I was wandering I can do something like "window.parent.left.<object name>", or how I can retreive the all object from another frame?
frame1 has:
<script language="javascript" type="text/javascript">
function CallToIt()
{
var str = window.parent.frame2.CallME();
alert(str);
}
</script>
frame 2 has:
<script language="javascript" type="text/javascript">
function ClassObj()
{
this.name = name;
this.setName = setName;
this.getObjName = getObjName;
function setName(name)
{
this.name = name;
}
function getObjName()
{
return this.name;
}
}
var testObj = new ClassObj();
testObj.setName("MyName");
function CallME()
{
return testObj.getObjName();
}
</script>
Thanks in advanced