Message between "child?" documents

12 views
Skip to first unread message

Jonas Thörnvall

unread,
Dec 3, 2021, 11:24:11 PM12/3/21
to
I have a main document with several child documents as iframes.
I have had no problem passing between child and parent, but now i want to mass message between two child documents, but i get error message that the iframe document does not exist?

So how should i pass the message between the childs.
This message
MultiID.document.getElementById("MVOL").value=CCvol;
Is sent from an iframe named SYNTHED , function.

I also tried
parent.MultiID.document.getElementById("MVOL").value=CCvol;

Jonas Thörnvall

unread,
Dec 3, 2021, 11:34:14 PM12/3/21
to
Passing a message between parent and child document is easy, just.
parent.document.getElementById("MVOL").value=CCvol; //From child to parent
MultiID.document.getElementById("MVOL").value=CCvol; //From parent to child

But howto pass from child to child?

Jonas Thörnvall

unread,
Dec 3, 2021, 11:46:16 PM12/3/21
to
I tried to find information but the information i find do just not apply?
Must i really pipe the call/message via a function within Parent???
MultiID->parent->Synthed???

Jonas Thörnvall

unread,
Dec 3, 2021, 11:47:50 PM12/3/21
to
That seem ugly need to invoke a parent function to pass it between them?

Jonas Thörnvall

unread,
Dec 4, 2021, 12:03:25 AM12/4/21
to
Well instead of send message from child, i decided to let child call a function in parent that will send the message to the other child.

luserdroog

unread,
Dec 4, 2021, 12:05:50 AM12/4/21
to
That's sounds like what I would recommend.
Function! Hurray. Functions always win.

Jonas Thörnvall

unread,
Dec 4, 2021, 12:28:43 AM12/4/21
to
Well actually it do work to pass child to child document by use.
parent.MultiID.document.getElementById("MVOL").value=CCvol;

The dynamically created MVOL element was simply missing ' ' around it so it was never registered as an ID.
But functions are nice. :)
Reply all
Reply to author
Forward
0 new messages