How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask TheDoctor Your Own Question
TheDoctor, Professional w/Adv. Degree
Category: Homework
Satisfied Customers: 1757
Experience:  M.S. in Internet Information Systems
Type Your Homework Question Here...
TheDoctor is online now
A new question is answered every 9 seconds

**For TheDoctor** Need a new improved background function

This answer was rated:

**For TheDoctor** Need a new improved background function similar to the one you did earlier today


More details you can find on

Hello again! Thank you for requesting me.

The PDF you provided is a single page and all it says is to move the JS to a different file. Is that all you need done? Move the background changing code to a separate file while keeping all the other JavaScript code in the index file where it was to begin with?

Customer: replied 3 years ago.
Yea I just need if i press example presPart3 or 4 or 5 it needs to call the js file with the bg imasges function all the other code can stay but the image background function to be in a seperate file.

In the PDF you sent me, the code is presPart1, 2, and 3.

Are you saying that you want to add additional parts, or rename the existing parts? If what you want is to be able to add additional pages, then please let me know.
Customer: replied 3 years ago.
In 0,1,2 i will have different functions. In 3,4,5 will be the Background i need u to do. And I will have 6,7,8 I also will have different functions.

So if you could just do the bg function fo presPart3,4,5
That is not what I need to know.

Will you be adding additional parts? As in, will index.html hae part 0, 1, 2, 3, 4, 5, 6, 7, 8?

Or will there be a DIFFERENT HTML FILE for parts 3, 4, 5, and a completely different HTML file for parts 6, 7, and 8?

Your answer completely changes the JavaScript code. So it is a very important distinction.
Customer: replied 3 years ago.
Yes the index will have additional parts

Hello again!

Please download the files here:

The code for the background is in the background JavaScript file.

I have altered it so that you can have as many pages as you want. Of course, the code needs initialized/called.

First, on line 27 of index.html, you will see:


This tells the background code that there are a total of three pages with backgrounds.

Next, the code needs triggered whenever the page is changed. This is done at index.html at line 130:


Now, let's say that you wanted to add a "Page4". You would change the integer passed into setupBackground to 4. You would also make certain that there is a bg13.jpg, bg14.jpg, and bg15.jpg in the images folder.

You can use this background JavaScript file in any page you want with however many images you want. You just need to 1.) pass to it the number of pages and 2.) call the updateBackground function on page change.

Customer: replied 3 years ago.

can we just change the links Page one: presPart1 to presPart3

Page two: presPart2 to prePart4 , and Page three: presPart3 to presPart5 links, because I have other function that will be called when calling prespart 0,1,2,


and the PresPart0 I just need a plain white background, When I click on it it changed the background too. I just need it to be the plain white background which is called from the bundle.css


I just need the presPart3 presPart4, presPart5 to call the background javascript image function.

That is why I asked if was ADDITIONAL or if you wanted to CHANGE the names. The change is a completely different code that I have to write. And you replied additional, not the change, so I didn't write the code that you are now asking for. I have to rewrite it again. I'll let you know once it is done.
Customer: replied 3 years ago.

Im sorry I thought that I did mentioned that I have additional files and needed to be change.

No, you've only mentioned 3, 4, 5, and made references to pages, which is not the name of a page, but of a link within a page. Then I specifically asked if there were separate files OR just additional items on the index, and you replied additional items on the index. So I wrote the code the opposite way of what you want.

This will be ready shortly.


You need to spend $3 to view this post. Add Funds to your account and buy credits.
TheDoctor and 3 other Homework Specialists are ready to help you
Customer: replied 3 years ago.

I got an issue when adding pages. After I add pages prespart6,7 etc. The link button doesnt work and it won topen the pages 3,4,5. Here is my whole folder. I just want prespart 3,4,5 to have images all the other pages will be different will have text I want them to be seperate I dont want to have to change nothing in the background.js file that file should just be for pages 3,4,5 all the rest should be able to do whatever

Alright. The last thing you told me was that the presParts would be in different files. They are not, they are all in the same file. So that requires different code. Now that I have seen what you have done, the accurate description is: "All nine presParts are in the same file, the background functionality is to be applied to only three parts: 3, 4, and 5". That was never clear from anything you said.

I would need to know that, as having different parts within the same file means that you need to limit the application of the code to specific parts. Having parts in different files, which is what you told me, means that you can simply apply the code to the page without explicitly limiting its application. These kinds of details and distinctions are critical when programming, which is why I asked about the location of the other parts multiple times. If you are not a professional programmer, I can understand not being as nit-picky as someone like me. But the saying "the devil's in the details" is never more true than with programming.


I've made the changes and here are the files: