473,322 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Next and Back Button not working

I have the following code from another website, its working fine there, but when I want to use it in another place I have an error about SCRIPT5009: 'swapImage' is undefined


Code:


Expand|Select|Wrap|Line Numbers
  1. <img width="100%" height="100%" id="mainImage" style="border: 1px solid black; border-image: none;" alt="" src="/services/PublishingImages/Slideshow/Slide1.JPG">
  2.  
  3. <script type="text/javascript">
  4.             // <![CDATA[
  5.             var currentIndex = 1;
  6.  
  7.             //*********NOTE: Set this value to the number of slides you have in the presentation.
  8.             var maxIndex = 17;
  9.  
  10.             function swapImage(imageIndex) {
  11.                 if (imageIndex > maxIndex) {
  12.                     currentIndex = maxIndex;
  13.                     return;
  14.                 }
  15.  
  16.                 if (imageIndex < 1) {
  17.                     currentIndex = 1;
  18.                     return;
  19.                 }
  20.  
  21.                 currentIndex = imageIndex;
  22.                 document.getElementById("mainImage").src = '/services/PublishingImages/Slideshow/Slide' + currentIndex + '.JPG';
  23.                 return;
  24.             }
  25.         </script>

Any Suggestion it will be appreciated.

Thanks
Aug 23 '16 #1
1 1119
gits
5,390 Expert Mod 4TB
what does 'in another place' mean exactly in your case? the error indicates that the method you want to call isnt found in that scope - so it would be better to see more of the code or an online testcase.
Aug 26 '16 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: bigbinc | last post by:
Is there a way to check for the back button? There has got to be a way with either vbscript/javascript. I could place redirect pages in there or some creative? any ideas?
9
by: jcnews | last post by:
When designing a webpage, is there a way to disable the back button? It must be possible. I am asking because there are certain web applications that I have used that require the user to...
25
by: KK | last post by:
Hi, I am using history.go(-1) for implementing the back button functionality. Its working fine but with this exception. 1. The page which is having back button has some hyperlinks on it. ...
29
by: Tom wilson | last post by:
I can't believe this is such an impossibility... I have an asp.net page. It accepts data through on form fields and includes a submit button. The page loads up and you fill out some stuff. ...
5
by: Tom wilson | last post by:
I'm developing an application that is a benefits enrolment website. The benefits can be of any type in any order as stored in a SQL server. On each page is a Back and Next button. At a certain...
3
by: dekern | last post by:
Good afternoon all, I guess I am missing the benefit of using datasets with Crystal. For years I have written wrapper apps that used the Pull method and I let Crystal do all the sql work. Now...
0
by: benthanger | last post by:
I just got my datagrid working with Atlas. I'm using the update panel. It's great but I immediately see an issue that I'm hoping there is an easy solution for. Imagine that you load a datagrid...
23
by: Bjorn | last post by:
Hi. Every time i post data in a form the contents are being checked for validity. When i click the back-button, all data is gone and i have to retype it. It's obvious that only a few or none of...
0
by: chixor1 | last post by:
Im hoping someone can help, I am working on a small program for class and have an array coming from a txt document. My application populates the array and data when I open it, however I am having...
1
by: CpVermont | last post by:
Good Morning, I am working on a page that uses ajax to display a list of products after a search. The content is displayed in 10 divs created in the DOM. If the search returns more than 10...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.