By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,384 Members | 1,794 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,384 IT Pros & Developers. It's quick & easy.

Gallery-type website update: problem in scrollLeft function

P: 2
Hey all,

I'm updating and adapting a gallery-type website that was done in FrontPage, in an old version. I've gotten most of it to work in modern browsers, but am stuck on one function... I am hoping someone can take a look and see where my trip-up lies. I've included just a snip from the html - where the debugger stops, thinking the problem is in the external js.

Thanks in advance for any guidance!! Really stuck on this!!

here is the event handler from the html page:

Expand|Select|Wrap|Line Numbers
  1.  ...
  2. <script type="text/javascript" src="thumbs/sldshow5.js"></script>
  3.  
  4.                 <div id="galleryLeftBtn">
  5.                 <img src="thumbs/prev.gif" onClick="javascript:scrollLeft()" alt="left arrow" title="previous image">
  6.                 <p>previous</p>
  7.                 </div>
  8.  ...
  9.  
And here is the problematic function:

Expand|Select|Wrap|Line Numbers
  1. ...
  2. function scrollLeft() 
  3. {
  4.     var el = document.getElementById("galleryListCell");
  5.     if (el) 
  6.     {
  7.         var coll = el.getElementsByTagName("a");
  8.         var count = 20;
  9.  
  10.         if (coll) 
  11.         {
  12.             for (i=1;i<coll.length;i++) 
  13.             {
  14.                 if (coll[i].style.display != "none") 
  15.                 {
  16.                     coll[i-1].style.display = "inline";
  17.                     break;    
  18.                 }
  19.             }
  20.  
  21.             for (i=0;i<coll.length;i++) 
  22.             {
  23.                 if (coll[i].style.display != "none") 
  24.                 {
  25.                     var images = coll[i].getElementsByTagName("img");
  26.                     count = count + 20 + images[0].width;
  27.  
  28.                     if (count > widthLength)
  29.                     {
  30.                         coll[i].style.display = "none";
  31.                     }
  32.                 }
  33.             }
  34.  
  35.             if ((el.scrollWidth - 4) >= el.clientWidth) 
  36.             {
  37.                 var btn = document.getElementById("galleryRightBtn");
  38.                 if (btn && rightdisabled) 
  39.                 {
  40.                     rightdisabled = false;
  41.                 }
  42.             }
  43.  
  44.             if (coll[0].style.display != "none") 
  45.             {
  46.                 var btn = document.getElementById("galleryLeftBtn");
  47.                 if (btn && !leftdisabled) 
  48.                 {
  49.                     leftdisabled = true;
  50.                 }
  51.             }
  52.         }
  53.     }
  54. }
  55. ...
  56.  
Here is a URL to see the whole offending page, if needed:
http://www.redrooster.us/enkart/works5.html

Thanks for any and all advice!!!!!!!
phrnck
Aug 28 '06 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
May be some other problem elsewhere. The first thing to check is the error console for errors in a decent browser.
Jun 11 '08 #2

Post your reply

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