{"id":1857,"date":"2026-01-04T07:50:00","date_gmt":"2026-01-04T06:50:00","guid":{"rendered":"http:\/\/labodemaths.fr\/WordPress3\/?p=1857"},"modified":"2026-01-06T09:02:19","modified_gmt":"2026-01-06T08:02:19","slug":"nsi-jshtml-et-css-tp3-le-tic-tac-toe","status":"publish","type":"post","link":"https:\/\/labodemaths.fr\/WordPress3\/nsi-jshtml-et-css-tp3-le-tic-tac-toe\/","title":{"rendered":"NSI : JS,HTML et CSS, TP2 le tic tac Toe"},"content":{"rendered":"\n<p>On consid\u00e8re le html suivant :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html lang=\"fr\"&gt;&lt;head&gt;&lt;meta http-equiv=\"Content-Type\" content=\"text\/html; charset=UTF-8\"&gt;\n  &lt;link rel=\"stylesheet\" href=\"style.css\"&gt;\n  &lt;title&gt;Tic Tac Toe&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n&lt;div id=\"plateau\"&gt;\n&lt;div id=\"regle\"&gt;&lt;\/div&gt;\n&lt;img src=\"images\/vide.png\"&gt;\n&lt;img src=\"images\/vide.png\"&gt;\n&lt;img src=\"images\/vide.png\"&gt;\n&lt;img src=\"images\/vide.png\"&gt;\n&lt;img src=\"images\/vide.png\"&gt;\n&lt;img src=\"images\/vide.png\"&gt;\n&lt;img src=\"images\/vide.png\"&gt;\n&lt;img src=\"images\/vide.png\"&gt;\n&lt;img src=\"images\/vide.png\"&gt;\n&lt;h1&gt;Cliquer pour commencer&lt;\/h1&gt;\n&lt;\/div&gt;\n    &lt;\/body&gt;\n\t&lt;script src=\"script.js\"&gt;&lt;\/script&gt;\n\t&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<p>le css suivant :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#plateau {\n    width: 33%;\n    margin-left: 33%;\n    margin-top:50px;\n}\n\nimg {\n    width: 30%;\n}<\/code><\/pre>\n\n\n\n<p>et les images suivantes :<\/p>\n\n\n\n<div class=\"wp-block-file\"><a href=\"https:\/\/labodemaths.fr\/WordPress3\/wp-content\/uploads\/2022\/01\/vide.png\">vide<\/a><a href=\"https:\/\/labodemaths.fr\/WordPress3\/wp-content\/uploads\/2022\/01\/vide.png\" class=\"wp-block-file__button\" download>T\u00e9l\u00e9charger<\/a><\/div>\n\n\n\n<div class=\"wp-block-file\"><a href=\"https:\/\/labodemaths.fr\/WordPress3\/wp-content\/uploads\/2022\/01\/rond.png\">rond<\/a><a href=\"https:\/\/labodemaths.fr\/WordPress3\/wp-content\/uploads\/2022\/01\/rond.png\" class=\"wp-block-file__button\" download>T\u00e9l\u00e9charger<\/a><\/div>\n\n\n\n<div class=\"wp-block-file\"><a href=\"https:\/\/labodemaths.fr\/WordPress3\/wp-content\/uploads\/2022\/01\/croix.png\">croix<\/a><a href=\"https:\/\/labodemaths.fr\/WordPress3\/wp-content\/uploads\/2022\/01\/croix.png\" class=\"wp-block-file__button\" download>T\u00e9l\u00e9charger<\/a><\/div>\n\n\n\n<h3>1. Mise en forme : CSS<\/h3>\n\n\n\n<p>Modifier le html et le css pour :<br>&#8211; afficher les r\u00e8gles du jeu dans l&rsquo;\u00e9l\u00e9ment regle,<br>&#8211; choisir une police de votre choix en utilisant <a rel=\"noreferrer noopener\" href=\"https:\/\/fonts.google.com\/\" target=\"_blank\">https:\/\/fonts.google.com\/<\/a> et l&rsquo;appliquer \u00e0 vos r\u00e8gles. On choisira \u00e9galement une taille de police et une couleur,<br>&#8211; choisir une autre police, une autre couleur et une autre taille pour l&rsquo;\u00e9l\u00e9ment h1,<br>&#8211; choisir une couleur de fond pour le plateau et une autre pour votre page ou si vous le pr\u00e9f\u00e9rez une image de fond.<br><\/p>\n\n\n\n<h3>2. Interactivit\u00e9 : JS<\/h3>\n\n\n\n<p>Ecrire un script js qui permettra aux joueurs de jouer en cliquant sur les images.<br>On indiquera Joueur 1 ou Joueur 2 dans l&rsquo;\u00e9l\u00e9ment h1 selon le tour des joueurs.<\/p>\n\n\n\n<h3>3. NIVEAU ++ JS<\/h3>\n\n\n\n<p>Le script JS permettra de d\u00e9terminer lorsqu&rsquo;un joueur a gagn\u00e9.<\/p>\n\n\n\n<h2>Proposition de correction 1 : le js des ann\u00e9es 2000<\/h2>\n\n\n\n<p>le html :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html lang=\"fr\"&gt;&lt;head&gt;&lt;meta http-equiv=\"Content-Type\" content=\"text\/html; charset=UTF-8\"&gt;\n  &lt;link rel=\"stylesheet\" href=\"style.css\"&gt;\n  &lt;title&gt;Tic Tac Toe&lt;\/title&gt;\n  &lt;link rel=\"preconnect\" href=\"https:\/\/fonts.googleapis.com\"&gt;\n&lt;link rel=\"preconnect\" href=\"https:\/\/fonts.gstatic.com\" crossorigin&gt;\n&lt;link href=\"https:\/\/fonts.googleapis.com\/css2?family=Patua+One&amp;display=swap\" rel=\"stylesheet\"&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n&lt;div id=\"plateau\"&gt;\n&lt;div id=\"regle\"&gt;\n&lt;p&gt;Pour gagner, il suffit d'aligner 3 symboles identiques&lt;\/p&gt;\n&lt;\/div&gt;\n&lt;img id=\"1\" src=\"images\/vide.png\" onclick=\"changer()\"&gt;\n&lt;img src=\"images\/vide.png\"&gt;\n&lt;img src=\"images\/vide.png\"&gt;\n&lt;img src=\"images\/vide.png\"&gt;\n&lt;img src=\"images\/vide.png\"&gt;\n&lt;img src=\"images\/vide.png\"&gt;\n&lt;img src=\"images\/vide.png\"&gt;\n&lt;img src=\"images\/vide.png\"&gt;\n&lt;img src=\"images\/vide.png\"&gt;\n&lt;h1&gt;Cliquer pour commencer&lt;\/h1&gt;\n&lt;\/div&gt;\n    &lt;\/body&gt;\n\t&lt;script src=\"script.js\"&gt;&lt;\/script&gt;\n\t&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<p>les css<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#plateau {\n    width: 33%;\n    margin-left: 33%;\n    margin-top:50px;\n\tcolor: #B58A81;\n\tfont-family: \"Patua One\", serif;\n  font-weight: 400;\n  font-style: normal;\n  font-size: 30px;\n}\nbody {\n\tbackground-color: #265E80;\n\t\n}\nimg {\n    width: 30%;\n}<\/code><\/pre>\n\n\n\n<p>le js<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function changer(){\n\tvar mon_image=document.getElementById(\"1\");\n\tmon_image.setAttribute(\"src\",\"images\/croix.png\");\n\t\n\t\n}<\/code><\/pre>\n\n\n\n<p>Evolution :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html>\r\n&lt;html lang=\"fr\">&lt;head>&lt;meta http-equiv=\"Content-Type\" content=\"text\/html; charset=UTF-8\">\r\n  &lt;link rel=\"stylesheet\" href=\"style.css\">\r\n  &lt;title>Tic Tac Toe&lt;\/title>\r\n  &lt;link rel=\"preconnect\" href=\"https:\/\/fonts.googleapis.com\">\r\n&lt;link rel=\"preconnect\" href=\"https:\/\/fonts.gstatic.com\" crossorigin>\r\n&lt;link href=\"https:\/\/fonts.googleapis.com\/css2?family=Patua+One&amp;display=swap\" rel=\"stylesheet\">\r\n&lt;\/head>\r\n&lt;body>\r\n&lt;div id=\"plateau\">\r\n&lt;div id=\"regle\">\r\n&lt;p>Pour gagner, il suffit d'aligner 3 symboles identiques&lt;\/p>\r\n&lt;\/div>\r\n&lt;img id=\"1\" src=\"images\/vide.png\" onclick=\"changer(1)\">\r\n&lt;img id=\"2\" src=\"images\/vide.png\" onclick=\"changer(2)\">\r\n&lt;img id=\"3\" src=\"images\/vide.png\" onclick=\"changer(3)\">\r\n&lt;img id=\"4\" src=\"images\/vide.png\" onclick=\"changer(4)\">\r\n&lt;img id=\"5\" src=\"images\/vide.png\" onclick=\"changer(5)\">\r\n&lt;img id=\"6\" src=\"images\/vide.png\" onclick=\"changer(6)\">\r\n&lt;img id=\"7\" src=\"images\/vide.png\" onclick=\"changer(7)\">\r\n&lt;img id=\"8\" src=\"images\/vide.png\" onclick=\"changer(8)\">\r\n&lt;img id=\"9\" src=\"images\/vide.png\" onclick=\"changer(9)\">\r\n&lt;h1>Cliquer pour commencer&lt;\/h1>\r\n&lt;\/div>\r\n    &lt;\/body>\r\n\t&lt;script src=\"script.js\">&lt;\/script>\r\n\t&lt;\/html><\/code><\/pre>\n\n\n\n<p>le js<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>joueur=1;\r\nfunction changer(numero){\r\n\tvar mon_image=document.getElementById(numero);\r\n\t\r\n\tif (mon_image.getAttribute(\"src\")==\"images\/vide.png\")\r\n\t{\r\n\t\tif (joueur==1){\r\n\tmon_image.setAttribute(\"src\",\"images\/croix.png\");\r\n\t\tjoueur=2;}\r\n\t\telse{\r\n\tmon_image.setAttribute(\"src\",\"images\/rond.png\");\r\n\t\tjoueur=1;}\r\n\t}\r\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>On consid\u00e8re le html suivant : le css suivant : et les images suivantes :&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/labodemaths.fr\/WordPress3\/nsi-jshtml-et-css-tp3-le-tic-tac-toe\/\">Read the post<span class=\"screen-reader-text\">NSI : JS,HTML et CSS, TP2 le tic tac Toe<\/span><\/a><\/div>\n","protected":false},"author":2,"featured_media":1861,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[57],"tags":[],"_links":{"self":[{"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/posts\/1857"}],"collection":[{"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/comments?post=1857"}],"version-history":[{"count":25,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/posts\/1857\/revisions"}],"predecessor-version":[{"id":2990,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/posts\/1857\/revisions\/2990"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/media\/1861"}],"wp:attachment":[{"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/media?parent=1857"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/categories?post=1857"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labodemaths.fr\/WordPress3\/wp-json\/wp\/v2\/tags?post=1857"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}