Um...
Actually... you could build the table in HTML and CSS first. Then you can use JS for checking only.
In the source code of the webpage you provided, they used tables, so just create a large table with <tr> and <td>. In the CSS, just set the table margin to zero, etc. In the cells with squares, add an <input> tag. If you only want one crossword puzzle with little reusability, simply type them in the HTML source code (very easy). Otherwise, add the input tags based on your XML file with the XML DOM and the HTML DOM (very difficult). Give your input tags a NAME attribute and start from zero since JS arrays start from zero.
Declare a constant array and load your letters inside it in the declaration. (JS provides a simple way to initialise an array: ["1", "A", "B"]) Then loop through your input fields and check if the input value matches the corresponding array element. Display the 'wrong' message if there's something wrong. (JS has a nifty break; statement which allows you to break out of an array, so you don't need to bother with the complicated code in Longman's Ch 23.) Otherwise display the 'right' message.
It shouldn't be too hard; it's always a good idea to check w3schools' reference if you're stuck.
http://w3schools.com/jsref/default.asp
[
本帖最後由 123qwerty 於 2013-4-17 09:41 PM 編輯 ]