I have parent.htm and child.htm
================================================== ===============
In parent.htm we have:
var parentarray = new Array(5)
window.open("child.htm",.....)
================================================== ===============
In child.htm I want to add new elements to parentarray, like
opener.parentarray[6] = ....... 7 5298
On 2008-10-25 02:17, ma**********@juno.com wrote:
In parent.htm we have:
var parentarray = new Array(5)
window.open("child.htm",.....)
In child.htm I want to add new elements to parentarray, like
opener.parentarray[6] = .......
And your problem is...?
- Conrad
Actually here is a more accurate desc of the prob:
parent.htm:
function parentarrayobject(last,first)
{
this.last = last
this.first = first
}
var parentarray = new Array()
parentarray[0] = new parentarrayobject("sixpack","joe") // this works
ok
window.open("child.htm",.....)
================================================== ===============
child.htm:
//--the alert works, pops up with "object"
alert(typeof(opener.parentarrayobject))
//--the next statement chokes... "Invalid procedure call or
argument"
opener.parentarray[1] = new
opener.parentarrayobject("fivepack","jane")
================================================== ===============
The problem is when trying to create parentarray[1] in child.htm it
keeps giving "Invalid procedure call or argument"
On 2008-10-25 23:10, ma**********@juno.com wrote:
Actually here is a more accurate desc of the prob:
...
child.htm:
//--the alert works, pops up with "object"
alert(typeof(opener.parentarrayobject))
//--the next statement chokes... "Invalid procedure call or
argument"
opener.parentarray[1] = new
opener.parentarrayobject("fivepack","jane")
================================================== ===============
The problem is when trying to create parentarray[1] in child.htm it
keeps giving "Invalid procedure call or argument"
Your script is working fine, except in Internet Explorer (please mention
that the next time!). Not sure what the cause is, except that it's not
related to the array. It also occurs if you only write
"new opener.parentarrayobject()". For some reason IE won't let you
create objects from a constructor that was defined in the parent window.
As a workaround, you could try calling a function in the opener, and
have the new parentarrayobject created there.
- Conrad
Le 10/25/08 2:17 AM, ma**********@juno.com a écrit :
I have parent.htm and child.htm
================================================== ===============
In parent.htm we have:
var parentarray = new Array(5)
window.open("child.htm",.....)
================================================== ===============
In child.htm I want to add new elements to parentarray, like
opener.parentarray[6] = .......
And ?
That doesn't work ?
That would have to.
--
sm
Le 10/25/08 11:10 PM, ma**********@juno.com a écrit :
Actually here is a more accurate desc of the prob:
try :
mother.htm :
<script type="text/javascript">
var tabl = [11,'hello',3];
</script>
</head>
<body>
<h1>parent</h1>
<p><button onclick="window.open('child.htm');">daughter</button>
<button onclick="alert(tabl)">voir </button>
child.htm :
<body>
<h1>children</h1>
<form action="#"
onsubmit="opener.tabl.push(this.elemt.value); return false;">
element to add : <input type="text" name="elemt">
<input type="submit" value="add">
</form>
<form action="#"
onsubmit="opener.tabl[this.indx.value] = [
this.val1.value,
this.val2.value
];
return false;">
index of element to modify : <input type="text" name="indx" size="5">
value 1 : <input type="text" name="val1">
value 2 : <input type="text" name="val2">
<input type="submit" value="modify">
</form>
<button onclick="alert(opener.tabl)">see the opener's array </button>
</body>
works with IE and Fx
--
sm
On 2008-10-26 02:43, SAM wrote:
onsubmit="opener.tabl[this.indx.value] = [
this.val1.value,
this.val2.value
];
...
works with IE and Fx
Sure, but it doesn't do what the OP was describing. It just adds an
array to the array in opener, not a new object. As I said earlier, the
array isn't the problem.
Something along these lines might work (untested):
// in parent:
function Person (first, last) {
this.first = first;
this.last = last;
}
function addPerson (first, last) {
persons.push(new Person(first, last));
}
var persons = [];
persons.push(new Person("Joe", "Sixpack"));
// in child:
opener.addPerson("Jane", "Fivepack");
This way the Person object is created in the same frame/window that also
holds its constructor. Maybe that'll make IE happy.
- Conrad
Le 10/26/08 2:03 AM, Conrad Lender a écrit :
On 2008-10-26 02:43, SAM wrote:
> onsubmit="opener.tabl[this.indx.value] = [ this.val1.value, this.val2.value ];
..
>works with IE and Fx
Sure, but it doesn't do what the OP was describing. It just adds an
array to the array in opener, not a new object. As I said earlier, the
array isn't the problem.
object or array what importance ?
the x element of original mother's array is changed in a new sub-array
if object is realy absolutly wanted :
onsubmit="opener.tabl[this.indx.value] = {
'name': this.val1.value,
'firstname': this.val2.value
};
--
sm This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Sims |
last post by:
Hi
I have a table with something like
ID PARENT
0 | -1
1 | -1
2 | 1
3 | 1
|
by: John MacIntyre |
last post by:
Hi,
I have a page with a series of child pages loaded into an iframe. When I
move from page to page, I store an object containing the child's control
data in a variable on the main page, then...
|
by: mrhicks |
last post by:
Hello all,
I need some advice/help on a particular problem I am having. I have
a basic struct called "indv_rpt_rply" that holds information for a
particular device in our system which I will...
|
by: Raj |
last post by:
Hi All,
I have a problem with trying to refresh the parent window from
child window in order to update data in the parent window.
The sequence of events are
1) I click a button in the parent...
|
by: Earl Teigrob |
last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
|
by: Manish |
last post by:
This is the print_r() for a variable $categories.
$categories ::
Array
(
=Array
(
=Array
(
|
by: Carlos Aguayo |
last post by:
If I have a parent and a child window, and if I create an array in the
child window, and pass it as a parameter to the parent window, it's
still an array, and its methods still work (like the...
|
by: Richard Harter |
last post by:
On Fri, 27 Jun 2008 09:28:56 -0700 (PDT), pereges
<Broli00@gmail.comwrote:
There are some obvious questions that should be asked, e.g., is
the contents of your array already sorted as your...
|
by: Buddha |
last post by:
Hello,
I posted this on two forums, without too much help .. and I am kinda
stuck in this.
I need to refresh the parent page from the second child window which
is opened by the first child and...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |