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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.