Is there a way to change the value of a dropdown from a frame?
The frame is from another website, but the value should be changed when the frame loaded.
to explain it more easily:
so I have an html site, where I added an iframe with the source to another frame of another website.
So when the page is loaded, the value of the dropdown lists should change.
I tried this:
for (var i = 0; i < window.parent.frames.length; i++) {
window.parent.frames[i].document.body.style.background = "red";
window.parent.frames[i].document.getElementById('bb_dropdown_from').value="Brussel / België (BRU)";
}
The first window parent: changed the background of the frame to read, but it changed back to white. (this was just to try).
the next one didn’t work at all.
Does someone know how to solve this problem?
thank you very much in advance!
You can not change the DOM of another domain. It should have the same origin policy before you can do this. Or is the iFrame on the same domain?
If it is only another subdomain you can set the
document.domainto the main domain, then you will be able to access the DOM.