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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:23:18+00:00 2026-05-23T13:23:18+00:00

I made this strobe light function and the strobe function worked. I’ve been trying

  • 0

I made this strobe light function and the strobe function worked. I’ve been trying to add functionality for resetting the website and stopping the strobe. I tried this code but it hasn’t worked. I’ve been trying to debug this for a while but can’t think of anything. If you have any ideas of how to make this work they’d be greatly appreciated.

var text1=document.body.style.backgroundColor;
var text2=document.body.style.color;
var boolean_value1=true;
var boolean_value2=true;
function strobe()
{
 if (boolean_value2)
 {
  document.body.style.backgroundColor = boolean_value1 ? 'black' : 'white';
  document.body.style.color = boolean_value1 ? 'white' : 'black';
  boolean_value1=!boolean_value1;
  setTimeout(strobe, 70); //in milliseconds
 }
 else
 {
  document.body.style.backgroundColor=text1;
  document.body.style.color=text2;
  alert("The else statement was executed...boolean_value2 evaluates to false");
 }
}

function stop_strobe()
{
 boolean_value2=false;
}

I think as of now the main problem is that boolean_value2 doesn’t evaluate to true. I can’t understand why though. Isn’t it a global variable? Yes, I have been calling these functions rather than just declaring them. But that’s in a different file that I know works….this one:

<html>

<head>
 <title>Blag!</title>
 <script type="text/javascript" src="/JAVASCRIPT/flash.js"></script>
 <script type="text/javascript" src="/JAVASCRIPT/konami.js"></script>
</head>



<body>
    <script type="text/javascript"> 
    // <![CDATA[

        var konami = new Konami();
        konami.pattern = "38384040373937396665";
        var counter=0;
        konami.code = function() {
            if ((counter%2)==0)
            {
             alert("You have entered the Konami code...enter it again to make it stop...")
             strobe();
             counter=counter+1;
            }
            else
            {
             stop_strobe();
            }
        };
        konami.load();

    // ]]>
    </script> 

</body>
  • 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-23T13:23:19+00:00Added an answer on May 23, 2026 at 1:23 pm

    When I test your code, it works just fine.

    Demo: http://jsfiddle.net/R43ky/


    You can use the setInterval method instead of setTimeout. That way you don’t have to set a new timeout from the callback method, and you can easily stop it:

    var text1 = document.body.style.backgroundColor;
    var text2 = document.body.style.color;
    var boolean_value1 = true;
    var interval;
    
    function strobe() {
      document.body.style.backgroundColor = boolean_value1 ? 'black' : 'white';
      document.body.style.color = boolean_value1 ? 'white' : 'black';
      boolean_value1 = !boolean_value1;
    }
    
    function start_strobe() {
      interval = window.setInterval(strobe, 70); //in milliseconds
    }
    
    function stop_strobe() {
      window.clearInterval(interval);
      document.body.style.backgroundColor = text1;
      document.body.style.color = text2;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i made this script that add in a mysql database information about who have
When i made this function: function makeThumbnail($type, $name, $size, $tmp_name, $thumbSize) { //make sure
Right now i made this: <a href=# title=[+] Add as favorite><div class=addFavorite></div></a> the class=addFavorite,
I have made this sandbox test: <html> <head> <title>whatever</title> <script type=text/javascript> function myLittleTest() {
To make my explanation shorter, I've made this mockup of what I'm trying to
I made this function and need some help sorting out the logic flow. It
I made this little program while reading Head First C# . I'm trying to
I made this function, the same result get printed twice. Any idea why? is
I made this function: char** parse_cmd(const char* cmdline) { int i; int j =
I've made this decorator, which results in an infinite redirect loop. The problem is

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.