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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:27:07+00:00 2026-06-14T19:27:07+00:00

<body> <script language=JavaScript> <!– var backImage = new Array(); backImage[0] = pics/img02.jpg; backImage[1] =

  • 0
<body>
<script language="JavaScript">
<!--

var backImage = new Array();
backImage[0] = "pics/img02.jpg";
backImage[1] = "pics/img03.jpg";
backImage[2] = "pics/img04.jpg";
backImage[3] = "pics/img05.jpg";

function changeBGImage(whichImage){
if (document.body){
document.body.background = backImage[whichImage];
backImage = backImage++;
}
}

//-->
</script>
<a href="javascript:changeBGImage(2)">Change</a>
</body>

sorry, i don’t get how i exactly should properly integrate code here -hopefully it still worked. what i want to do here: change the background (that works) than add plus one to the background counter so that the next time the link is clicked the next background shows (that doesn’t work). it should be quite simple but i couldn’t figure it out nevertheless…

  • 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-14T19:27:10+00:00Added an answer on June 14, 2026 at 7:27 pm

    Use a static counter that counts from 0 to 3.

    var cnt = 0;
    
    function changeBGImage(){
      if (document.body){
        document.body.background = backImage[cnt];
        cnt = (cnt+1) % 4; // mod 4
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code that works fine in IE: <HTML> <BODY> <script language=JavaScript>
See example: <!DOCTYPE html> <html> <head> <title>language</title> <script type=text/javascript src=http://www.google.com/jsapi> </script> </head> <body> <div
I made this Greasemonkey script: var maxpi = 250; var p1 = /html/body/div/div[2]/div/div[2]/table[2]/tbody/tr[1]/td[11]; var
$.post('includes/script.php', $(this).serialize(), function(data) { $('body').append(data); }); alert ($('#new').length) php script is <php echo <div
I am having a little problem here. I have a <script language =JavaScript runat=server>
<html> <head> <script language = javascript> show = function() { document.getElementById(name).innerHTML = window.opener.game.pl.guild.n; var
The following code works nicely: <script type=text/javascript> var prm = Sys.WebForms.PageRequestManager.getInstance(); prm.add_initializeRequest(InitializeRequest); prm.add_endRequest(EndRequest); function
I have a java script function that i have called on body load mousemove()
I have a script that loads big images into the body in this fashion
Here is my script : <body> <div id =mainCategory class='fade'> Category</div> <div id=divSubCategory> Category1

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.