New to Javascript: How can I automate interaction between framecontents from different domains?

T

Ted Byers

If I understand the FAQ correctly, I can't access the contents of one
frame from another frame if they're from different frames.

I believe I can access the contents of a field using what looks like
"document.dialer_form.comments.value"

The dialer is from one domain, and I have created a cgi script that
creates the contents of a second frame. Actually, my prototype web
page has two frames, one of which has a search engine that invokes my
cgi script to produce the contents of a second frame. But right now,
my colleagues that have to use these pages have to have one browser
connected to the dialer's web page, and a second connected to my page,
and they have to copy the contents of one field in the dialer's page
and paste it into a field in my search engine, and pres submit to get
the rest of the data they need. I want to make this faster,
automatic, to reduse the chances of human error. So I thought I would
try to load the dialer's page into a new, third, frame in my page, and
create an event handler so that when the contents of that one field in
the dialer's web page changes, the value is automatically submitted to
my search engine.

If I can't access the contents of a control in the contents of one
frame from another from a different domain, can I do so from the
frameset page that places that content into a frame it contains, to
add the appropriate parameter to the SRC attribute of the other
frame? And if the correct name of the control is what I gave above,
how would that name change if I try to access it from a frameset or
frame that needs it?

If the info I need is in one or more FAQ's, please provide the URL
that will lead me to it. I have been searching through the FAQ at
http://jibbering.com/faq, but I may have missed queries that would be
relevant.

NB: while I have written very little Javascript, I have extensive
experience using Java, C++, Perl, JSP/JSF, ... I am just faced with
an issue now that isn't so easily addressed using the languages I
know.

Thanks in advance for your aide.

Ted
 
T

Thomas 'PointedEars' Lahn

Ted said:
If I understand the FAQ correctly, I can't access the contents of one
frame from another frame if they're from different frames.

If you mean "second-level domain" instead of "frames", you understood correctly.
I believe I can access the contents of a field using what looks like
"document.dialer_form.comments.value"

Whereas it should be

document.forms["dialer_form"].elements["comments"].value

provided that the form with name or ID "dialer_form" is in the same
document, that is, it is not located within an (i)frame in the document.
If it were, you would need something along

window.frames[...].document.forms[...].elements[...].value
The dialer is from one domain, and I have created a cgi script that
creates the contents of a second frame.

Actually, my prototype web page has two frames, one of which has a search
engine that invokes my cgi script to produce the contents of a second
frame.

You appear to be a bit confused about when to use "domain" and when "frame".
Assuming you mean "domain in an (i)frame" instead of "frame" here:
[...] So I thought I would try to load the dialer's page into a new,
third, frame in my page, and create an event handler so that when the
contents of that one field in the dialer's web page changes, the value is
automatically submitted to my search engine.

ISTM you do not need a third frame as you can add event listeners to the
form in the first frame that shows the dialer. But I could be wrong as I
find your description rather long-winded and (thus) confusing (especially
this summer).
If I can't access the contents of a control in the contents of one frame
from another from a different domain, can I do so from the frameset page
that places that content into a frame it contains, to add the appropriate
parameter to the SRC attribute of the other frame?

Mu.

(Use transparent proxying to access the other domain's resources.
Note that copyright applies, and take care of XSS.)
And if the correct name of the control is what I gave above, how would
that name change if I try to access it from a frameset or frame that
needs it?

Mu, again.

(The name of the control would not change.) The _referencing_ depends on
where the control is located in relation to the frame. Look into the
`parent', `top', and `frames' properties of Window objects.
If the info I need is in one or more FAQ's, please provide the URL that
will lead me to it. I have been searching through the FAQ at
http://jibbering.com/faq, but I may have missed queries that would be
relevant.

Possible. What search terms have you used?

The most pertinent document to read in your case, besides section 1.3 of
the FAQ and documents linked there, would probably be
<http://www.catb.org/~esr/faqs/smart-questions.html> (linked in the FAQ
Notes), as the lack of other replies to your posting, but the existence of
replies to newer postings would indicate that other people are having
similar difficulties understanding your posting and answering your questions.
NB: while I have written very little Javascript, I have extensive
experience using Java, C++, Perl, JSP/JSF, ... I am just faced with an
issue now that isn't so easily addressed using the languages I know.

It is not a matter of the programming language but about knowing your
tools (and knowing what you are doing with them). You are dealing with
language-independent DOM APIs in this case.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top