Results 1 to 3 of 3

Thread: Changing text in one frame from another frame.

  1. #1
    Join Date
    Oct 2006
    Location
    Shanghai, China
    Posts
    36
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Changing text in one frame from another frame.

    Hi,

    I want to "rotate" (change) the text in some frames without reloading the pages.

    To do this I have created a "control" frame that will reload and then change the text, but I can't get it to work.

    Code for visible frame "adframe":
    Code:
    <html><body background='./images/backgrounds/marble.jpg'>
    <div id="ads"></div>
    </body></html>
    Code for "control" frame:
    Code:
    <script language="JavaScript"><!--
    top.adframe.document.getElementById('ads').innerHTML="Buy My Stuff!";
    </script>
    it says "Error: 'top.adframe.document.getElementById(...)' is null or not an object"

    It worked when I used top.adframe.document.write("Buy My Stuff!"), but it just added the line over an over, it didn't replace it.

    What am I doing wrong?

  2. #2
    Join Date
    May 2006
    Location
    Alaska
    Posts
    163
    Thanks
    5
    Thanked 2 Times in 2 Posts

    Default

    Maybe you're not letting adframe load first? For your control frame,do
    Code:
    top.onload = function () {
    top.adframe.document.getElementById('ads').innerHTML="Buy My Stuff!";
    }

  3. #3
    Join Date
    Oct 2006
    Location
    Shanghai, China
    Posts
    36
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thank you. I will try that tomorrow.

    But I think I read something about how you can't use the innerHTML function with a frame. Is that true?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •