SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2008
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Display block when scroll value equals.

    Hey so I am struggling with this little bit of code and I am hoping that someone out there could tell me if I am wrong or why it wouldn't work
    Code:
    function next_image(){
    	var pos = document.getElementById('image_control').scrollLeft+=900;
    	
    	if(pos==900){document.getElementsByTagName('td').item(1).style.display='block';}
    
    	return pos;
    	}
    Last edited by smpily; Mar 8, 2011 at 13:52. Reason: Update subject.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,696
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Here's the structure of that assignment.

    var foo = bar += 900;

    Both foo and bar will be updated to the increased value.
    Do you really want to make a change to the scrollLeft property of that element?
    Should the += be just a + instead?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •