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 8856443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:21:28+00:00 2026-06-14T14:21:28+00:00

Purpose of the code shown is to add by time some reminder. the cases

  • 0

Purpose of the code shown is to add by time some reminder. the cases are for different days of the week and in that days specific times.
Strange thing some statements are working most not, but i dont see what breaks the code:

    function refreshTime() {
  var now = getTime();
  $('#date').html(now.day + ', ' + now.date + '. ' + now.month);
  $('#time').html("<span class='hour'>" + now.hour + "</span>" + "<span class='minute'>" + now.minute + "</span>" + "<span class='second'>" + now.second + "</span>");
  if (now.day != "Sonntag" && now.day != "Samstag")
    {
    if (now.hour == "9" && now.minute >= "50")
      {
      var left = "60" - now.minute;
      $('#gh').html("<span class='gh_remind'>Grosshandel einstellen in " + left + " Minuten!</span>");
      }
    if (now.hour == '11' && now.minute >= '50')
      {
      var left = '60' - now.minute;
      $('#gh').html("<span class='gh_remind'>Grosshandel einstellen in " + left + " Minuten!</span>");
      } 
    if (now.hour == '14' && now.minute >= '50')
      {
      var left = '60' - now.minute;
      $('#gh').html("<span class='gh_remind'>Grosshandel einstellen in " + left + " Minuten!</span>");
      }
    if (now.hour == "17" && now.minute >= "50")
      {
      var left = "60" - now.minute;
      $('#gh').html("<span class='gh_remind'>Grosshandel einstellen in " + left + " Minuten!</span>");
      }
     else
     {
     $('#gh').html("");
     }      
    }
  if (now.day == "Samstag")
    {
    if (now.hour == "9" && now.minute >= "50")
      {
      var left = "60" - now.minute;
      $('#gh').html("<span class='gh_remind'>Grosshandel einstellen in " + left + " Minuten!</span>");
      }
    if (now.hour == "12" && now.minute >= "50")
      {
      var left = "60" - now.minute;
      $('#gh').html("<span class='gh_remind'>Grosshandel einstellen in " + left + " Minuten!</span>");
      } 
    if (now.hour == "13" && now.minute >= "50")
      {
      var left = "60" - now.minute;
      $('#gh').html("<span class='gh_remind'>Grosshandel einstellen in " + left + " Minuten!</span>");
      }     
    else
     {
     $('#gh').html("");
     }         
    }

}

Thanks for your help!

  • 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-14T14:21:29+00:00Added an answer on June 14, 2026 at 2:21 pm

    Consider this:

    var a = 'a', b;
    if (a == 'a') {
      b = 'right';
    }
    if (a == 'c') {
      b = 'wrong';
    }
    else {
      b = 'FOOBAR!';
    }
    alert(b);
    

    Even though you (probably) expect b to store 'right' value in the end of that if structure, it – surprise, surprise! – will contain FOOBAR instead. The reason is that if all your ifs are written like this, they’re independent of each other. The first one will assign 'right' string to b variable – but the second one, going through else branch, will happily reassign it (to some foobar).

    If you want to create a chain of ifs, use if - else if - else syntax instead:

    var a = 'a', b;
    if (a == 'a') {
      b = 'right';
    }
    else if (a == 'c') {
      b = 'wrong';
    }
    else {
      b = 'FOOBAR!';
    }
    alert(b);
    

    Now that will show you the right thing, right? )

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

Sidebar

Related Questions

Need help on below errors highlighted in the code comments shown below The purpose
I've got following (simplified for example purpose) code and it works: void log(const string
The purpose of this code is to pull upgrade.zip from a central server, extract
Quick question, What have I done wrong here. The purpose of this code is
Suppose i have the code snippet as follows : ( clarification purpose/not well formed
What is the purpose of these java.lang.annotation imports in this code? Why are they
One recommends me the following code apparently only in .zshrc without explaining its purpose
What is the main purpose of overloading operators in C++? In the code below,
I run the following code on a Windows platform. The purpose is the know
I am not sure about the exact purpose of the following Rampion's code .

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.