Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8255979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:42:48+00:00 2026-06-08T01:42:48+00:00

I Have 3 html files & 3 js files index.html,rank.html,score.html global.js,rank.js,score.js In index.html I

  • 0

I Have 3 html files & 3 js files

index.html,rank.html,score.html

global.js,rank.js,score.js

In index.html I have included rank.html and score.html using iframe.

In global.js I have declare Var rank; & global.js included in rank.html & score.html.

I am updating the value of rank in rank.js and i want to access the updated value in score.js. In score.js I dont get the Updated value It gives UNDEFINED value.

I dont want to include rank.js in score.html so i created global.js & included in html file.

Here is my code,

Index.html

<html>
    <head>

    </head>
    <body>
<iframe src="../rank/rank.html" frameborder = "0" scrolling="no" width="50%" height = "100%"></iframe>
<iframe src="score.html" frameborder = "0" scrolling="no" width="50%" height = "100%"></iframe>

    </body>
</html> 

global.js

var rank;

score.js

$(document).ready(
        function(){     


                    setInterval(dataupdate, 10000);


    });
function dataupdate() { 

alert(rank) 

};

rank.js

$(document).ready(
            function(){     


                        setInterval(dataupdate, 10000);


        });
    function dataupdate() { 

    rank = "first";

    };

I want updated value of rank in score.js file how to access that value…

Thanks…..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T01:42:49+00:00Added an answer on June 8, 2026 at 1:42 am

    When you declare a global variable like you’ve done it gets created as a property of the window object, i.e window.rank. Your main window and the 2 iframes have separate window objects and therefore window.rank assigned from the main frame is not the same window.rank accessed from one of the iframes.

    For accessing the rank property of the main window object from inside an iframe, you can use parent.rank instead of window.rank

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I will try to explain my problem. I have 4 files index.html, event.js, start.js
I have IIS running under Windows XP. I have .html files with classic ASP
I have multiple HTML files which vary only by a little - a few
I have some html files and want to extract only lines with containing these
I have some html files that I want to convert to text. I have
i have 20 HTML files ok ? i am going to shake the iphone
I have some html files with their own css. I want to use them
I have around 1000 html files in my local computer and I have to
I'm newbie at TYPO3, trying to install my custom template. I have HTML/CSS/IMAGES files,
I have a bunch of html files that come with my app and are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.