View Full Version : What's better, layers, or Tables?
07-08-2004, 01:39 PM
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.
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.
07-08-2004, 02:42 PM
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?
07-08-2004, 02:49 PM
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:
It's an interesting site. Not the greatest, but it gives you some ideas on how layers are used.
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.