Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Dec 2003
    Location
    America
    Posts
    544
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What's better, layers, or Tables?

    I am interested in creating a game board, like chess, or checkers, but i need to know whether or not a for-loop would work better with a layer tag, or a table tag. My idea is real simple actually: I create some input boxes through the form elements, and once the information is collected, a function uses that information to create the result. The function of course will be activated through a button, or a link. Which would be better?

    And just in case you might be wondering, i will use the innerHTML, rather than the document.write() method, since that only works before the page loads, and not for when the page is loaded.
    LovesWar

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i think, given that a chess board is a grid layout, that you're best going for table layout since that's already a datagrid of sorts. doing it through layers would add a whole lot more unecessary coding.

    the fact that a chess board is arguably already tabular data should make tables the natural element to represent one.

  • #3
    New Coder
    Join Date
    Jun 2004
    Location
    Coventry, UK
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Agree

    I agree with the table idea, as it does appear easier. I dont now much about layers though, so could someone give me the lowdown?

    LOTS8

  • #4
    Regular Coder
    Join Date
    Dec 2003
    Location
    America
    Posts
    544
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lol.

    Well, i dont know that much either actually. And people are suprised at me saying that. But its true. Layers technically is a concept used mainly by NetScape, and in theory, it alternative to controlling lay-outs on a webpage. The thing with layers, as far as i know, is that you have to know a pretty good deal of CSS before you can really use them effectively. Layers, from what i seem to have ran into, rely a lot on the div tags for their actual existance. But the over-all properties of a layer are controlled through CSS.

    If you are interested in learning some of the power of layers, i would suggest you look at the following links:

    http://www.dansteinman.com/dynduo/
    http://www.dansteinman.com/dynduo/index.html

    It's an interesting site. Not the greatest, but it gives you some ideas on how layers are used.
    LovesWar

  • #5
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    using layers for layout from an HTML and CSS point of view is no more difficult than using tables.

    however, for a datagrid - such as a chessboard - you want to use tables, since it's tabular data. also, the JS for traversing that is already in place, since there are arrays for its rows and cells.

    to find any given space on the board is as simple as finding the row and cell of the table the space occupies. to loop thru this tabular data therefore just means two for loops - the outer one to find the row and the inner loop to find the cell within the row.


  •  

    Posting Permissions

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