variable value in another frame - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

variable value in another frame

myrddinmyrddin Posts: 3Member
I am attempting to change the style of an object in frame A using javascript in frame B. Everything I have seen says I can do it with the following:
window.parent.frames["A"].document.getElementById('variable').style.backgroundcolor="#212121";

However, I get an error stating the object is "null or not an object". Any insight is much appreciated.

Comments

  • mac_doggiemac_doggie Posts: 488Member
    : I am attempting to change the style of an object in frame A using javascript in frame B. Everything I have seen says I can do it with the following:
    : window.parent.frames["A"].document.getElementById('variable').style.backgroundcolor="#212121";
    :
    : However, I get an error stating the object is "null or not an object". Any insight is much appreciated.
    :
    :
    You can also use top.frames["A"] this prevents you from making mistakes with framesets within other framesets etc.

    You should also now that you can only acces these Javascript variables if the pages in both frames are on the same domain. You can's acces variables from oter websites for security reasons...
    ;-)
    -mac-
    mailto:[email protected]
    the Netherlands...


Sign In or Register to comment.