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

  • Home
  • SEARCH
  • 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 1023999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:42:48+00:00 2026-05-16T11:42:48+00:00

window.onload = init; function init(){ initializeEventHandlers(); getData(formatDate(new Date)); gotoDate(‘today’); } //scripts that manage the

  • 0
window.onload = init;

function init(){
   initializeEventHandlers();
   getData(formatDate(new Date));
   gotoDate('today');
}

//scripts that manage the UI for tracker.aspx
var dCurrentDate, sCurrentDate, sCurrentDayData, stepsVal, chipsVal, dayValue, dateValue, caloriesVal;
var fCurrentValue = 0;
var bAnimating, bSliding = false;

   //scripts that manage the UI for tracker.aspx
    var dCurrentDate, sCurrentDate, sCurrentDayData, stepsVal, chipsVal, dayValue, dateValue, caloriesVal;
    var fCurrentValue = 0;
    var bAnimating, bSliding = false;

getData(d)
{
  steps = 5;
  calories = 10;
  chipsAmount = 3;
}


//I expect this to be 5+1, but it actually through an exception. I am wondering if its cause steps is not yet loaded. What can I do to make this actually 5 + 1.
steps + 1;

I load data from an XML which the sets some values. The probem I am facing is that when i set the values in the GetData method. The vars declared lose there value after the onload. What am i doing wrong and how can i make the values retain

  • 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-05-16T11:42:49+00:00Added an answer on May 16, 2026 at 11:42 am

    Are the variables you’re loading the data into defined in the global scope? From your getData() function, if you’re setting the data to the steps, calories, and chipsAmount variables, they won’t be accessible outside that function. You’ll have to define those three variables outside the function so that they’re in the global scope.

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

Sidebar

Related Questions

This is one script that sets the cookie with some html file. window.onload=init; function
Consider this: window.onload = function () { myObj.init(); }; var myObj = { init:
Following is the javascript code var text; var name; window.onload = init; function init()
I just copy pasted this bit from a book: window.onload = init; function init()
When I run window.onload = function () { document.addEventListener(deviceready, getGeolocation); } function getGeolocation() {
function icPageInit() { $(icImgDiv + icAlternate()).setOpacity(0); return true; } window.onload = icPageInit; This piece
I now understand that the following code will not work because I'm assigning window.onload
I have a large javascript function init() that hides and shows a large number
This is a crossbrowser window.onload script, I want to add a message, when the
I am having trouble with the window.onload and document.onload events. Everything I read tells

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.