Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédente | |||
| playground:abc [26/04/2012 21:18] – jpc | playground:abc [26/04/2012 21:19] (Version actuelle) – jpc | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | HAN Geng | + | RU |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | Quiz </ | + | |
| - | <SCRIPT languag=" | + | |
| - | < | + | |
| - | + | ||
| - | // Copyright Cyril Roiron | + | |
| - | // All rights reserved | + | |
| - | + | ||
| - | var ttok=""; | + | |
| - | + | ||
| - | // les tablos necessaires | + | |
| - | var question = new Array(); | + | |
| - | + | ||
| - | var a=0; | + | |
| - | var b=0; | + | |
| - | var x=0; | + | |
| - | var m=0; | + | |
| - | + | ||
| - | + | ||
| - | question[m] = "Quel est le genre du film?" | + | |
| - | m++; | + | |
| - | question[m] = "Quel est le sujet trait�? " | + | |
| - | // les tablos necessaires | + | |
| - | var f_b = new Array(); | + | |
| - | var correct = new Array(); | + | |
| - | var rep = new Array(); | + | |
| - | + | ||
| - | // cr�e la fen�tre principale avec son contenu | + | |
| - | function creefenetre(contenu, | + | |
| - | { | + | |
| - | var cc = contenu; | + | |
| - | contenu = "< | + | |
| - | | + | |
| - | } | + | |
| - | + | ||
| - | function verifier(yo) | + | |
| - | { | + | |
| - | var resultat=""; | + | |
| - | var erreur=0; | + | |
| - | + | ||
| - | for (var n=0; n < (question.length); | + | |
| - | { | + | |
| - | if (!rep[n]) | + | |
| - | { | + | |
| - | ttok=ttok+" | + | |
| - | ttok=ttok+"'" | + | |
| - | } | + | |
| - | + | ||
| - | else { | + | |
| - | if(correct[n] == 1) | + | |
| - | { | + | |
| - | rep[n]="< | + | |
| - | // | + | |
| - | } | + | |
| - | else | + | |
| - | { | + | |
| - | rep[n]="< | + | |
| - | erreur++; | + | |
| - | } | + | |
| - | resultat+="< | + | |
| - | } | + | |
| - | } | + | |
| - | + | ||
| - | if (ttok != "" | + | |
| - | { alert(ttok); | + | |
| - | else { | + | |
| - | + | ||
| - | if (erreur==0) | + | |
| - | { | + | |
| - | resultat+="< | + | |
| - | } | + | |
| - | else | + | |
| - | { | + | |
| - | if (erreur==1) | + | |
| - | { | + | |
| - | resultat+="< | + | |
| - | } | + | |
| - | else | + | |
| - | { | + | |
| - | resultat+="< | + | |
| - | } | + | |
| - | } | + | |
| - | + | ||
| - | for (var i=0; i< | + | |
| - | { | + | |
| - | yo.elements[i].checked = 0; | + | |
| - | } | + | |
| - | + | ||
| - | creefenetre(resultat, | + | |
| - | + | ||
| - | } | + | |
| - | } | + | |
| - | + | ||
| - | + | ||
| - | // --> | + | |
| - | </ | + | |
| - | + | ||
| - | + | ||
| - | </ | + | |
| - | <BODY bgcolor=" | + | |
| - | + | ||
| - | <H2 align=center> | + | |
| - | Quiz </ | + | |
| - | + | ||
| - | <form name=" | + | |
| - | < | + | |
| - | + | ||
| - | < | + | |
| - | <!-- | + | |
| - | | + | |
| - | // | + | |
| - | </ | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | | + | |
| - | | + | |
| - | // | + | |
| - | </ | + | |
| - | + | ||
| - | < | + | |
| - | < | + | |
| - | + | ||
| - | < | + | |
| - | < | + | |
| - | | + | |
| - | | + | |
| - | // | + | |
| - | </ | + | |
| - | + | ||
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | | + | |
| - | | + | |
| - | // | + | |
| - | </ | + | |
| - | + | ||
| - | <hr> | + | |
| - | + | ||
| - | < | + | |
| - | <!-- | + | |
| - | | + | |
| - | // | + | |
| - | </ | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | | + | |
| - | | + | |
| - | // | + | |
| - | </ | + | |
| - | + | ||
| - | < | + | |
| - | + | ||
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | | + | |
| - | | + | |
| - | // | + | |
| - | </ | + | |
| - | + | ||
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | | + | |
| - | | + | |
| - | // | + | |
| - | </ | + | |
| - | + | ||
| - | <hr> | + | |
| - | + | ||
| - | + | ||
| - | <p align=center> | + | |
| - | <input type=button value=" | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | </ | + | |
| - | </ | + | |
| - | + | ||
| - | < | + | |
| - | < | + | |
| - | < | + | |
| - | <meta name=" | + | |
| - | <style type=" | + | |
| - | + | ||
| - | body, h1, h2, h3, h4, h5, h6 | + | |
| - | { | + | |
| - | font-family: | + | |
| - | } | + | |
| - | + | ||
| - | h1, h2, h3, h4, h5, h6 | + | |
| - | { | + | |
| - | color: #5d6a86; | + | |
| - | } | + | |
| - | + | ||
| - | body | + | |
| - | { | + | |
| - | cursor: default; | + | |
| - | font-size: small; | + | |
| - | } | + | |
| - | + | ||
| - | .ecw-answerbox | + | |
| - | { | + | |
| - | color: black; | + | |
| - | background-color: | + | |
| - | border-color: | + | |
| - | border-style: | + | |
| - | border-width: | + | |
| - | display: block; | + | |
| - | padding: .75em; | + | |
| - | width: 240pt; | + | |
| - | } | + | |
| - | + | ||
| - | .ecw-box | + | |
| - | { | + | |
| - | border-style: | + | |
| - | border-width: | + | |
| - | cursor: pointer; | + | |
| - | font-size: .12in; | + | |
| - | font-weight: | + | |
| - | height: .18in; | + | |
| - | overflow: hidden; | + | |
| - | text-align: | + | |
| - | width: .18in; | + | |
| - | } | + | |
| - | + | ||
| - | .ecw-boxcheated_sel | + | |
| - | { | + | |
| - | background-color: | + | |
| - | border-color: | + | |
| - | color: #2080D0; | + | |
| - | } | + | |
| - | + | ||
| - | .ecw-boxcheated_unsel | + | |
| - | { | + | |
| - | background-color: | + | |
| - | border-color: | + | |
| - | color: #2080D0; | + | |
| - | } | + | |
| - | + | ||
| - | .ecw-boxerror_sel | + | |
| - | { | + | |
| - | background-color: | + | |
| - | border-color: | + | |
| - | color: #BF0000; | + | |
| - | } | + | |
| - | + | ||
| - | .ecw-boxerror_unsel | + | |
| - | { | + | |
| - | background-color: | + | |
| - | border-color: | + | |
| - | color: #BF0000; | + | |
| - | } | + | |
| - | + | ||
| - | .ecw-boxnormal_sel | + | |
| - | { | + | |
| - | background-color: | + | |
| - | border-color: | + | |
| - | color: #000000; | + | |
| - | } | + | |
| - | + | ||
| - | .ecw-boxnormal_unsel | + | |
| - | { | + | |
| - | background-color: | + | |
| - | border-color: | + | |
| - | color: #000000; | + | |
| - | } | + | |
| - | + | ||
| - | .ecw-button | + | |
| - | { | + | |
| - | width: 64pt; | + | |
| - | } | + | |
| - | + | ||
| - | .ecw-cluebox | + | |
| - | { | + | |
| - | border-bottom-width: | + | |
| - | border-color: | + | |
| - | border-left-width: | + | |
| - | border-right-width: | + | |
| - | border-style: | + | |
| - | border-top-width: | + | |
| - | margin-top: | + | |
| - | padding-bottom: | + | |
| - | padding-left: | + | |
| - | padding-right: | + | |
| - | padding-top: | + | |
| - | } | + | |
| - | + | ||
| - | .ecw-crosswordarea | + | |
| - | { | + | |
| - | background-color: | + | |
| - | border-color: | + | |
| - | border-style: | + | |
| - | border-width: | + | |
| - | padding: .5em; | + | |
| - | font-family: | + | |
| - | font-size: small; | + | |
| - | } | + | |
| - | + | ||
| - | .ecw-copyright | + | |
| - | { | + | |
| - | margin-bottom: | + | |
| - | font-size: x-small; | + | |
| - | font-family: | + | |
| - | } | + | |
| - | + | ||
| - | .ecw-input | + | |
| - | { | + | |
| - | font-family: | + | |
| - | } | + | |
| - | + | ||
| - | .ecw-wordlabel | + | |
| - | { | + | |
| - | text-transform: | + | |
| - | margin: 0; | + | |
| - | } | + | |
| - | + | ||
| - | .ecw-wordinfo | + | |
| - | { | + | |
| - | font-size: 8pt; | + | |
| - | color: #808080; | + | |
| - | } | + | |
| - | + | ||
| - | .ecw-worderror | + | |
| - | { | + | |
| - | color: #c00000; | + | |
| - | font-weight: | + | |
| - | display: none; | + | |
| - | margin-top: | + | |
| - | } | + | |
| - | + | ||
| - | --></ | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | < | + | |
| - | <h3 style=" | + | |
| - | + | ||
| - | <div id=" | + | |
| - | This interactive crossword puzzle requires JavaScript and a reasonably recent web browser, such as Internet Explorer 5.5 | + | |
| - | or later, Netscape 7, Mozilla, Firefox, or Safari. | + | |
| - | the page. If this web page is saved to your computer, you may need to click the yellow Information Bar at the top of | + | |
| - | the page to allow the puzzle to load. | + | |
| - | </ | + | |
| - | + | ||
| - | <table cellpadding=" | + | |
| - | + | ||
| - | <td class=" | + | |
| - | + | ||
| - | <script type=" | + | |
| - | CrosswordWidth = 20; | + | |
| - | CrosswordHeight = 20; | + | |
| - | Words = 15; | + | |
| - | WordLength = new Array(9, 7, 15, 7, 10, 6, 10, 6, 7, 15, 15, 9, 13, 7, 7); | + | |
| - | Word = new Array(" | + | |
| - | Clue = new Array(" | + | |
| - | "Il a été construit par Le Vau et Mansart", | + | |
| - | "La voleuse du château", | + | |
| - | " | + | |
| - | "Ils vivent à la cour de Versailles", | + | |
| - | "Vous en avez reçu une du Roi", | + | |
| - | "Lieu de tous les mystères", | + | |
| - | "Le surnom du roi Louis XIV", | + | |
| - | "Il était composé de 540 diamants", | + | |
| - | "On l'a soupçonné lors de l' | + | |
| - | "Une célèbre reine, connue pour ses dépenses", | + | |
| - | "Le code à respecter à la Cour de Versailles", | + | |
| - | "Un des surnoms de Marie Antoinette", | + | |
| - | "La galerie des Glaces en compte 357", | + | |
| - | " | + | |
| - | AnswerHash = new Array(53347, | + | |
| - | WordX = new Array(10, 2, 2, 6, 10, 0, 9, 7, 16, 4, 2, 7, 10, 19, 0); | + | |
| - | WordY = new Array(1, 3, 5, 9, 11, 12, 14, 17, 0, 2, 5, 5, 5, 5, 12); | + | |
| - | LastHorizontalWord = 7; | + | |
| - | OnlyCheckOnce = false; | + | |
| - | //--> | + | |
| - | </ | + | |
| - | + | ||
| - | <script type=" | + | |
| - | + | ||
| - | // EclipseCrossword (C) Copyright 2000-2007 Green Eclipse. | + | |
| - | // www.eclipsecrossword.com | + | |
| - | + | ||
| - | var BadChars = " | + | |
| - | + | ||
| - | var TableAcrossWord, | + | |
| - | var CurrentWord, | + | |
| - | var CrosswordFinished, | + | |
| - | + | ||
| - | // Check the user's browser and then initialize the puzzle. | + | |
| - | if (document.getElementById(" | + | |
| - | { | + | |
| - | document.getElementById(" | + | |
| - | + | ||
| - | // Current game variables | + | |
| - | CurrentWord = -1; | + | |
| - | PrevWordHorizontal = false; | + | |
| - | + | ||
| - | // Create the cell-to-word arrays. | + | |
| - | TableAcrossWord = new Array(CrosswordWidth); | + | |
| - | for (var x = 0; x < CrosswordWidth; | + | |
| - | TableDownWord = new Array(CrosswordWidth); | + | |
| - | for (var x = 0; x < CrosswordWidth; | + | |
| - | for (var y = 0; y < CrosswordHeight; | + | |
| - | for (var x = 0; x < CrosswordWidth; | + | |
| - | { | + | |
| - | TableAcrossWord[x][y] = -1; | + | |
| - | TableDownWord[x][y] = -1; | + | |
| - | } | + | |
| - | + | ||
| - | // First, add the horizontal words to the puzzle. | + | |
| - | for (var i = 0; i <= LastHorizontalWord; | + | |
| - | { | + | |
| - | x = WordX[i]; | + | |
| - | y = WordY[i]; | + | |
| - | for (var j = 0; j < WordLength[i]; | + | |
| - | { | + | |
| - | TableAcrossWord[x + j][y] = i; | + | |
| - | } | + | |
| - | } | + | |
| - | + | ||
| - | // Second, add the vertical words to the puzzle. | + | |
| - | for (var i = LastHorizontalWord + 1; i < Words; i++) | + | |
| - | { | + | |
| - | x = WordX[i]; | + | |
| - | y = WordY[i]; | + | |
| - | for (var j = 0; j < WordLength[i]; | + | |
| - | { | + | |
| - | TableDownWord[x][y + j] = i; | + | |
| - | } | + | |
| - | } | + | |
| - | + | ||
| - | // Now, insert the row HTML into the table. | + | |
| - | for (var y = 0; y < CrosswordHeight; | + | |
| - | { | + | |
| - | document.writeln("< | + | |
| - | for (var x = 0; x < CrosswordWidth; | + | |
| - | { | + | |
| - | if (TableAcrossWord[x][y] >= 0 || TableDownWord[x][y] >= 0) | + | |
| - | document.write("< | + | |
| - | else | + | |
| - | document.write("< | + | |
| - | } | + | |
| - | document.writeln("</ | + | |
| - | } | + | |
| - | + | ||
| - | // Finally, show the crossword and hide the wait message. | + | |
| - | Initialized = true; | + | |
| - | document.getElementById(" | + | |
| - | document.getElementById(" | + | |
| - | } | + | |
| - | + | ||
| - | // ---------- | + | |
| - | // Event handlers | + | |
| - | + | ||
| - | // Raised when a key is pressed in the word entry box. | + | |
| - | function WordEntryKeyPress(event) | + | |
| - | { | + | |
| - | if (CrosswordFinished) return; | + | |
| - | // Treat an Enter keypress as an OK click. | + | |
| - | if (CurrentWord >= 0 && event.keyCode == 13) OKClick(); | + | |
| - | } | + | |
| - | + | ||
| - | // ---------- | + | |
| - | // Helper functions | + | |
| - | + | ||
| - | // Called when we're ready to start the crossword. | + | |
| - | function BeginCrossword() | + | |
| - | { | + | |
| - | if (Initialized) | + | |
| - | { | + | |
| - | document.getElementById(" | + | |
| - | document.getElementById(" | + | |
| - | } | + | |
| - | } | + | |
| - | + | ||
| - | // Returns true if the string passed in contains any characters prone to evil. | + | |
| - | function ContainsBadChars(theirWord) | + | |
| - | { | + | |
| - | for (var i = 0; i < theirWord.length; | + | |
| - | if (BadChars.indexOf(theirWord.charAt(i)) >= 0) return true; | + | |
| - | return false; | + | |
| - | } | + | |
| - | + | ||
| - | // Pads a number out to three characters. | + | |
| - | function PadNumber(number) | + | |
| - | { | + | |
| - | if (number < 10) | + | |
| - | return " | + | |
| - | else if (number < 100) | + | |
| - | return " | + | |
| - | else | + | |
| - | return "" | + | |
| - | } | + | |
| - | + | ||
| - | // Returns the table cell at a particular pair of coordinates. | + | |
| - | function CellAt(x, y) | + | |
| - | { | + | |
| - | return document.getElementById(" | + | |
| - | } | + | |
| - | + | ||
| - | // Deselects the current word, if there' | + | |
| - | function DeselectCurrentWord() | + | |
| - | { | + | |
| - | if (CurrentWord < 0) return; | + | |
| - | var x, y, i; | + | |
| - | + | ||
| - | document.getElementById(" | + | |
| - | ChangeCurrentWordSelectedStyle(false); | + | |
| - | CurrentWord = -1; | + | |
| - | + | ||
| - | } | + | |
| - | + | ||
| - | // Changes the style of the cells in the current word. | + | |
| - | function ChangeWordStyle(WordNumber, | + | |
| - | { | + | |
| - | if (WordNumber< | + | |
| - | var x = WordX[WordNumber]; | + | |
| - | var y = WordY[WordNumber]; | + | |
| - | + | ||
| - | if (WordNumber< | + | |
| - | for (i = 0; i < WordLength[WordNumber]; | + | |
| - | CellAt(x + i, y).className = NewStyle; | + | |
| - | else | + | |
| - | for (i = 0; i < WordLength[WordNumber]; | + | |
| - | CellAt(x, | + | |
| - | } | + | |
| - | + | ||
| - | // Changes the style of the cells in the current word between the selected/ | + | |
| - | function ChangeCurrentWordSelectedStyle(IsSelected) | + | |
| - | { | + | |
| - | if (CurrentWord < 0) return; | + | |
| - | var x = WordX[CurrentWord]; | + | |
| - | var y = WordY[CurrentWord]; | + | |
| - | + | ||
| - | if (CurrentWord <= LastHorizontalWord) | + | |
| - | for (i = 0; i < WordLength[CurrentWord]; | + | |
| - | CellAt(x + i, y).className = CellAt(x + i, y).className.replace(IsSelected ? " | + | |
| - | else | + | |
| - | for (i = 0; i < WordLength[CurrentWord]; | + | |
| - | CellAt(x, | + | |
| - | } | + | |
| - | + | ||
| - | // Selects the new word by parsing the name of the TD element referenced by the | + | |
| - | // event object, and then applying styles as necessary. | + | |
| - | function SelectThisWord(event) | + | |
| - | { | + | |
| - | if (CrosswordFinished) return; | + | |
| - | var x, y, i, TheirWord, TableCell; | + | |
| - | + | ||
| - | // Deselect the previous word if one was selected. | + | |
| - | document.getElementById(" | + | |
| - | if (CurrentWord >= 0) OKClick(); | + | |
| - | DeselectCurrentWord(); | + | |
| - | + | ||
| - | // Determine the coordinates of the cell they clicked, and then the word that | + | |
| - | // they clicked. | + | |
| - | var target = (event.srcElement ? event.srcElement: | + | |
| - | x = parseInt(target.id.substring(1, | + | |
| - | y = parseInt(target.id.substring(4, | + | |
| - | + | ||
| - | // If they clicked an intersection, | + | |
| - | if (TableAcrossWord[x][y] >= 0 && TableDownWord[x][y] >= 0) | + | |
| - | CurrentWord = PrevWordHorizontal ? TableDownWord[x][y] : TableAcrossWord[x][y]; | + | |
| - | else if (TableAcrossWord[x][y] >= 0) | + | |
| - | CurrentWord = TableAcrossWord[x][y]; | + | |
| - | else if (TableDownWord[x][y] >= 0) | + | |
| - | CurrentWord = TableDownWord[x][y]; | + | |
| - | + | ||
| - | PrevWordHorizontal = (CurrentWord <= LastHorizontalWord); | + | |
| - | + | ||
| - | // Now, change the style of the cells in this word. | + | |
| - | ChangeCurrentWordSelectedStyle(true); | + | |
| - | + | ||
| - | // Then, prepare the answer box. | + | |
| - | x = WordX[CurrentWord]; | + | |
| - | y = WordY[CurrentWord]; | + | |
| - | TheirWord = ""; | + | |
| - | var TheirWordLength = 0; | + | |
| - | for (i = 0; i < WordLength[CurrentWord]; | + | |
| - | { | + | |
| - | // Find the appropriate table cell. | + | |
| - | if (CurrentWord <= LastHorizontalWord) | + | |
| - | TableCell = CellAt(x + i, y); | + | |
| - | else | + | |
| - | TableCell = CellAt(x, y + i); | + | |
| - | // Add its contents to the word we're building. | + | |
| - | if (TableCell.innerHTML != null && TableCell.innerHTML.length > 0 && TableCell.innerHTML != " " && TableCell.innerHTML.toLowerCase() != "& | + | |
| - | { | + | |
| - | TheirWord += TableCell.innerHTML.toUpperCase(); | + | |
| - | TheirWordLength++; | + | |
| - | } | + | |
| - | else | + | |
| - | { | + | |
| - | TheirWord += "& | + | |
| - | } | + | |
| - | } | + | |
| - | + | ||
| - | document.getElementById(" | + | |
| - | document.getElementById(" | + | |
| - | document.getElementById(" | + | |
| - | document.getElementById(" | + | |
| - | document.getElementById(" | + | |
| - | if (TheirWordLength == WordLength[CurrentWord]) | + | |
| - | document.getElementById(" | + | |
| - | else | + | |
| - | document.getElementById(" | + | |
| - | + | ||
| - | // Finally, show the answer box. | + | |
| - | document.getElementById(" | + | |
| - | try | + | |
| - | { | + | |
| - | document.getElementById(" | + | |
| - | document.getElementById(" | + | |
| - | } | + | |
| - | catch (e) | + | |
| - | { | + | |
| - | } | + | |
| - | + | ||
| - | } | + | |
| - | + | ||
| - | // Called when the user clicks the OK link. | + | |
| - | function OKClick() | + | |
| - | { | + | |
| - | var TheirWord, x, y, i, TableCell; | + | |
| - | if (CrosswordFinished) return; | + | |
| - | if (document.getElementById(" | + | |
| - | + | ||
| - | // First, validate the entry. | + | |
| - | TheirWord = document.getElementById(" | + | |
| - | if (TheirWord.length == 0) | + | |
| - | { | + | |
| - | DeselectCurrentWord(); | + | |
| - | return; | + | |
| - | } | + | |
| - | if (ContainsBadChars(TheirWord)) | + | |
| - | { | + | |
| - | document.getElementById(" | + | |
| - | document.getElementById(" | + | |
| - | return; | + | |
| - | } | + | |
| - | if (TheirWord.length < WordLength[CurrentWord]) | + | |
| - | { | + | |
| - | document.getElementById(" | + | |
| - | document.getElementById(" | + | |
| - | return; | + | |
| - | } | + | |
| - | if (TheirWord.length > WordLength[CurrentWord]) | + | |
| - | { | + | |
| - | document.getElementById(" | + | |
| - | document.getElementById(" | + | |
| - | return; | + | |
| - | } | + | |
| - | + | ||
| - | // If we made it this far, they typed an acceptable word, so add these letters to the puzzle and hide the entry box. | + | |
| - | x = WordX[CurrentWord]; | + | |
| - | y = WordY[CurrentWord]; | + | |
| - | for (i = 0; i < TheirWord.length; | + | |
| - | { | + | |
| - | TableCell = CellAt(x + (CurrentWord <= LastHorizontalWord ? i : 0), y + (CurrentWord > LastHorizontalWord ? i : 0)); | + | |
| - | TableCell.innerHTML = TheirWord.substring(i, | + | |
| - | } | + | |
| - | DeselectCurrentWord(); | + | |
| - | } | + | |
| - | + | ||
| - | // Called when the "check puzzle" | + | |
| - | function CheckClick() | + | |
| - | { | + | |
| - | var i, j, x, y, UserEntry, ErrorsFound = 0, EmptyFound = 0, TableCell; | + | |
| - | if (CrosswordFinished) return; | + | |
| - | DeselectCurrentWord(); | + | |
| - | + | ||
| - | for (y = 0; y < CrosswordHeight; | + | |
| - | for (x = 0; x < CrosswordWidth; | + | |
| - | if (TableAcrossWord[x][y] >= 0 || TableDownWord[x][y] >= 0) | + | |
| - | { | + | |
| - | TableCell = CellAt(x, y); | + | |
| - | if (TableCell.className == " | + | |
| - | } | + | |
| - | + | ||
| - | for (i = 0; i < Words; i++) | + | |
| - | { | + | |
| - | // Get the user's entry for this word. | + | |
| - | UserEntry = ""; | + | |
| - | for (j = 0; j < WordLength[i]; | + | |
| - | { | + | |
| - | if (i <= LastHorizontalWord) | + | |
| - | TableCell = CellAt(WordX[i] + j, WordY[i]); | + | |
| - | else | + | |
| - | TableCell = CellAt(WordX[i], | + | |
| - | if (TableCell.innerHTML.length > 0 && TableCell.innerHTML.toLowerCase() != "& | + | |
| - | { | + | |
| - | UserEntry += TableCell.innerHTML.toUpperCase(); | + | |
| - | } | + | |
| - | else | + | |
| - | { | + | |
| - | UserEntry = ""; | + | |
| - | EmptyFound++; | + | |
| - | break; | + | |
| - | } | + | |
| - | } | + | |
| - | // If this word doesn' | + | |
| - | if (HashWord(UserEntry) != AnswerHash[i] && UserEntry.length > 0) | + | |
| - | { | + | |
| - | ErrorsFound++; | + | |
| - | ChangeWordStyle(i, | + | |
| - | } | + | |
| - | } | + | |
| - | + | ||
| - | // If they can only check once, disable things prematurely. | + | |
| - | if ( OnlyCheckOnce ) | + | |
| - | { | + | |
| - | CrosswordFinished = true; | + | |
| - | document.getElementById(" | + | |
| - | } | + | |
| - | + | ||
| - | // If errors were found, just exit now. | + | |
| - | if (ErrorsFound > 0 && EmptyFound > 0) | + | |
| - | document.getElementById(" | + | |
| - | else if (ErrorsFound > 0) | + | |
| - | document.getElementById(" | + | |
| - | else if (EmptyFound > 0) | + | |
| - | document.getElementById(" | + | |
| - | + | ||
| - | if (ErrorsFound + EmptyFound > 0) | + | |
| - | { | + | |
| - | document.getElementById(" | + | |
| - | return; | + | |
| - | } | + | |
| - | + | ||
| - | // They finished the puzzle! | + | |
| - | CrosswordFinished = true; | + | |
| - | document.getElementById(" | + | |
| - | document.getElementById(" | + | |
| - | document.getElementById(" | + | |
| - | } | + | |
| - | + | ||
| - | // Called when the " | + | |
| - | function CheatClick() | + | |
| - | { | + | |
| - | if (CrosswordFinished) return; | + | |
| - | var OldWord = CurrentWord; | + | |
| - | document.getElementById(" | + | |
| - | OKClick(); | + | |
| - | ChangeWordStyle(OldWord, | + | |
| - | } | + | |
| - | + | ||
| - | // Returns a one-way hash for a word. | + | |
| - | function HashWord(Word) | + | |
| - | { | + | |
| - | var x = (Word.charCodeAt(0) * 719) % 1138; | + | |
| - | var Hash = 837; | + | |
| - | var i; | + | |
| - | for (i = 1; i <= Word.length; | + | |
| - | Hash = (Hash * i + 5 + (Word.charCodeAt(i - 1) - 64) * x) % 98503; | + | |
| - | return Hash; | + | |
| - | } | + | |
| - | + | ||
| - | //--> | + | |
| - | </ | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | <td valign=" | + | |
| - | + | ||
| - | <div class=" | + | |
| - | <a href=" | + | |
| - | </ | + | |
| - | + | ||
| - | <div id=" | + | |
| - | < | + | |
| - | < | + | |
| - | </ | + | |
| - | + | ||
| - | <div id=" | + | |
| - | <h3 id=" | + | |
| - | <div id=" | + | |
| - | <div id=" | + | |
| - | <div style=" | + | |
| - | <input class=" | + | |
| - | </ | + | |
| - | <div id=" | + | |
| - | + | ||
| - | <table border=" | + | |
| - | <button id=" | + | |
| - | </ | + | |
| - | <button id=" | + | |
| - | <button id=" | + | |
| - | </ | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | <div id=" | + | |
| - | < | + | |
| - | < | + | |
| - | </ | + | |
| - | <p>If you would like to be able to create interactive | + | |
| - | <a href=" | + | |
| - | like this yourself, get <a href=" | + | |
| - | from Green Eclipse& | + | |
| - | </ | + | |
| - | </ | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | <div style=" | + | |
| - | <button id=" | + | |
| - | </ | + | |
| - | + | ||
| - | <script language=" | + | |
| - | BeginCrossword(); | + | |
| - | //--> | + | |
| - | </ | + | |
| - | + | ||
| - | <!-- Created with EclipseCrossword, | + | |
| - | + | ||
| - | </ | + | |