Web Analytics Made Easy -
StatCounter Centering a Javascript scroller? - CodingForum


No announcement yet.

Centering a Javascript scroller?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Centering a Javascript scroller?

    Hi all,
    I'm new to the board, and hope I won't be annoying anyone by asking for some help on this topic. Thanks for reading and any help is greatly appreciated. Let me explain what's perplexing me...

    I'm planning on replacing all the 'text-areas' of my web-pages with a "Java script text-scroller", the main advantage and reason I'm using the code being that it has a scrollbar and customizable up/down buttons.
    I have aligned the content, up button, down button, and scrollbar by positioning them using an amount of pixels from the 'top' and 'left' of the window. This was fine when I used absolute DIV's to align everything on the page (all the images and text), but I've started aligning everything with centered-tables now as to avoid changing resolution problems, yet I can't seem to align/center the scroller along with my tables (containing images) when the window changes size.
    The source code to my particular problem can be found here on this test page I have up with the JavaScript scroller code in full.

    I really don't know if I should be using tables/changing the js code/ or using frames to fix the problem. I've been using stopgaps now for weeks simply because I can't get around it, and am in the middle of re-designing my site and want to sort this out once and for all.

    All ideas, suggestions, criticisms or a plain "what you're asking can't be done" would be really appreciated.
    Thanks for your time and help, take care.

  • #2
    Advise 1 next time you try and write an url in a forum or anywhere else for that matter load the page of the url 1st and cut and paste from the browsers address bar would have saved u the faulty link.

    real link:http://www.geocities.com/belljar_band/help.htm

    I looked your code over, I never got the scroller to actually scroll lol :P


    1. <style> tags in general goes in the head,IMO.

    2. Javascripts that do not produce content on document load goes in the head to, IMO.

    3. Tables are build <table><tr><td></td></tr></table>, with optional numbers of td's in a tr and tr's in a table.

    4. Spans ain't div's, div's are div's.

    5. I suggest u put the bg pic as the table background and then put put the scrollarea in that table. remember to put a position:relative in the incapsulating table.(position:absolute) is in aspect to the 1st parent with a defined position)(in IE at least).

    6. try and group style declarations. make them easier to read, and each group written with declarations in most important---least important. IMO.
    Position group.(Position,Top,Left,Width,Height,Z-index)
    Looks group.(Colors,Borders,Visibility)
    Ur style:
    style="Z-INDEX: 4; LEFT: 635px; VISIBILITY: visible; WIDTH: 12px; POSITION: absolute; TOP: 15px; HEIGHT: 35px"
    how I would write it:
    style="POSITION: absolute;TOP: 15px;LEFT: 635px; WIDTH: 12px;   HEIGHT: 35px;Z-INDEX: 4; VISIBILITY: visible; "
    Last edited by Garadon; Feb 11, 2004, 05:32 PM.