SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict Mr Jojo's Avatar
    Join Date
    May 2007
    Posts
    322
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with pseudo-JavaScript code: Javascript: var x = 1;

    I have this iframe:

    <iframe name="maria" src="mypage.html"></iframe>

    and lets imagine that mypage.html has some variable called 'x' defined with JS.
    It starts with the value 0, but now, from outside the iframe i want to change it to 1.

    I would think on something like var document.getelementbyid("maria").x = 1;

    Is it right?

  2. #2
    SitePoint Evangelist
    Join Date
    Jul 2007
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think
    Code:
    window.maria.x = 1;
    
    // or just
    
    maria.x = 1;
    
    // or, depending on what other frames you have,
    
    frames[0].x = 1;
    iframes are treated just like normal frames and are added to the frames[] collection.


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
  •