javascript q
- Started
- Last post
- 13 Responses
- drgs
why is this not working, opens a new window which contains a form, uses window reference to change values and submits, anyone can have a quick glimse over this
var window_1; // global value
function function_1() {
window_1 = window.open('http...');
setTimeout(function_2, 10000); // 10 secs to load
}function function_2()
{
window_1.forms['postform'].eleme... = 'test';
window_1.forms['postform'].submi...
}function_1 is called in body onload in the opened window
- cosmo0
could you post a link to the problem, so that we can have an example?
- drgs0
sorry dont have it online. the window opens ok, nothing happens afterwards
i tested it in two-split frame page, that is I had a script in the upper frame, and the opened url with forms and everything in the lower, it worked fine, so this part
forms['postform'].elements['comm... = 'test';
and
forms['postform'].submit();
are perfectly fine
- drgs0
no wait, i actually i tracked it down to these lines
window_1.forms['postform'].eleme... = 'test';
window_1.forms['postform'].submi...
- acescence0
window_1.document.forms[''].etc...
- drgs0
mmm didnt help,
i added alert('ok'); inbetween after the first
window_1.document.forms..etc
line there, never got the alert
it seems to stop there
the froms and the elements are def. there
- drgs0
btw, the form and the textarea are marked by id, not by name
that is
- acescence0
well i didn't mean what i typed literally, you just need to insert "document" between window_1 and forms[]
- drgs0
i did... it didnt work
i then added alert(ok) to see if its executed after the first line
it didnt
- drgs0
funny, structurally its no differetn to my script....
thnx, i need to digest this for a while.....*bookmarks pastebin.se!
- acescence0
both pages need to be in the same domain, or it will fail due to cross site scripting restrictions
- drgs0
well, they are in different domains! but it worked with the frames method i mentioned....
- drgs0
this works with safari 1.3.2, when i open a cross site page in lower_frame:
is this a flaw?