473,434 Members | 1,593 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,434 software developers and data experts.

syntax error I'm not finding

tpgames
785 512MB
I can't get this script to recognize that the image name is
Image53.jpg, Image54.jpg, etc. instead of 53.jpg, 54.jpg.
What am I doing wrong? I'm trying to not have to change a thousand image names. :D

Expand|Select|Wrap|Line Numbers
  1. //change x=0 to x=1 change current= 0 to current = 1 Works!
  2.  
  3. // The 1 = the first image number for both X and Current!
  4.  
  5. imgName = new Array()
  6. for (x=53; x<=100; x++) {
  7. imgName[x] = x
  8. }
  9.  
  10. contextPath = " http://www.tpgames.net/gaming/4/2/tpgames/zwp/tce/";
  11. extensionJ = "Image";
  12. extensionK = ".jpg";
  13.  
  14. current = 47;      //ONLY CHANGE THIS NUMBER! MAKE 10 PER STORY
  15.  
  16. //window.onload = randomizeImage
  17.  
  18. function randomizeImage() {
  19. changeImg()
  20. }
  21.  
  22. function changeImg() {
  23. holder = document.getElementById("bgHolder");
  24. holder.style.background="url(" + contextPath + extensionJ + imgName[current] + extensionK + ")";
  25.  
  26. if (current < imgName.length-1) {    current = current+1 }
  27. else { current = 1 }
  28. setTimeout('randomizeImage()',1000);
  29. }
  30.  
  31. setTimeout('randomizeImage()',1000);//only is executed on pageload
  32. function randomizeImage() {
  33. holder = document.getElementById("bgHolder");
  34. if (holder==null){
  35. setTimeout('randomizeImage()',1000);}
  36. else{
  37. changeImg();
  38. }
  39. }
Jun 21 '09 #1
3 1511
acoder
16,027 Expert Mod 8TB
There's no need for the array. Just use the current number in place of the array.

What's the error message and on which line?
Jun 22 '09 #2
tpgames
785 512MB
I don't get an actual error message. It doesn't even recognize...Hold on!
I think I might have found the error. The silly URL to the JS file isn't even correct! LOL If I ever figure out how to compare A to A to B and read that B does not = A, I will be so happy! :D I'll post back in minute.
Jun 22 '09 #3
tpgames
785 512MB
Fixed! I had flipped the folders /js/ and /e/ around when I typed it in and when I checked to see if it was typed in correctly, I didn't see that it wasn't. Thats always the first thing I check because its usually the error. *twitch eyes*
Wrong: ~.net/css/js/e/tce1.js
Correct: ~.net/css/e/js/tce1.js

I thought the syntax error was in my JS. Silly me! I should have known that I wasn't see the links correctly. Oh well, at least I knew that there was something I wasn't seeing correctly. LOL
Thanks!
Jun 22 '09 #4

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

Similar topics

1
by: Wayne | last post by:
Hi, Can someone possibly assist me in finding the error in the following: echo "<p><strong>".($i+1).". Login: "; I get the following error returned when doing a syntax check PHP Parse...
1
by: Larry Bates | last post by:
It doesn't happen often, but once in a while I will introduce a syntax error into a Python program I'm working on (in IDLE) and doing File-Check responds with the expected "Failed to check, syntax...
3
by: priscilla.jenkins | last post by:
Alright, I'm really new to SQL and VBA and all this, so I might be completely off course...but just tell me. I know C and Assembly, but that doesn't help me much here. I'm trying to create a...
6
by: Scott Nixon | last post by:
New to Postgres 7.3 from 7.0. Am having some trouble with a query that worked in 7.0 but not in 7.3.....can't seem to figure out the syntax or find info about how to do this anywhere. ...
9
by: Tin Gherdanarra | last post by:
Hallo, I'm trying to install pypgsql. However, I get syntax errors while compiling the C sources. The following excerpt from pgconnection.h looks a little funny to me: typedef struct {...
5
by: Sheldon | last post by:
Hi Everyone, I am new here but I am pretty good at python programming but I am not exert. I have been away from programming for about a year and now I am programming in python again in...
0
by: jacqueharper | last post by:
I am having a problem with an Excel ListObject in my C# .NET application. I am trying to map an XML schema to a ListObject, and continue to get the error "The XPath is not valid because either the...
1
by: tkpmep | last post by:
I'm trying to optimize a function using SciPy's optimize.fmin, but am clearly getting the syntax wrong, and would be grateful for some guiidance. First, here's the function def func(Y,x): """Y...
14
by: kigoobe | last post by:
Well guys, I have tested a script that's working well in FF, however while testing with IE7, I am finding errors. That famous yellow warning icon at the left of our status bar. Basically, I am...
14
riverdale1567
by: riverdale1567 | last post by:
Hi I am a newbie trying to get some of my first code working, yada yada yada. I have a drop down box which chooses a state then takes the post data to 'processform2.php' to use that to pull up...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.