CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript programming (http://www.codingforums.com/forumdisplay.php?f=2)
-   -   Why does this work intermittently? (http://www.codingforums.com/showthread.php?t=272576)

3591wjr 09-08-2012 03:31 PM

Why does this work intermittently?
 
It is a page of thumbs. Click on a thumb and a display pops up allowing user to view pix in sequence by clicking a button.

the first 15 thumbs are active - numbers 0 - 14.
Sometimes it won't show any. Sometimes it will show the first 4, or the first 12, then just stop working.

[URL="http://www.zootgeist.com/allhouston/thumbs1.html"]

You can view source to see code.
My first post, sorry if it does not conform.
Thank you

DrDOS 09-08-2012 03:59 PM

a href="avascript:void(0)" an error that shows up in three places.

It looks pretty but the code is really poor. You're using javascript.void(), you have an array but you're not using the array to any advantage in the coding so you have a lot of redundant code, all not good.

You could use 'this' functionality with the array, and reduce all the code below the body tag to a few lines, and have everything work well.

3591wjr 09-08-2012 11:24 PM

reply to why working intermittently
 
Thanks for the reply. I am certainly not going to argue about my code. I will look up the "this" technology.
But how am I not using the array to its best advantage?
I use it to preload, and then reference it to change the image.
I am not trying to be defensive, but am very curious.
Thanks.



Code:

document.getElementById('holder').style.backgroundImage="url(" + picArray[x] + ")";


All times are GMT +1. The time now is 01:24 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.