{"id":574406,"student_id":2589,"content":"{\"html\":\"\u003c!DOCTYPE html\u003e\\n\u003chtml\u003e\\n\u003chead\u003e\\n\\t\u003ctitle\u003eDocument\u003c/title\u003e\\n \u003cscript src=\\\"https://code.jquery.com/jquery-3.2.1.min.js\\\"\u003e\u003c/script\u003e\\n\u003c/head\u003e\\n\u003cbody\u003e\\n \u003ch1\u003eTic Tac Toe\u003c/h1\u003e\\n \u003cdiv class=\\\"grid\\\"\u003e\\n \u003cdiv id=\\\"a\\\"\u003e\u003c/div\u003e\\n \u003cdiv id=\\\"b\\\"\u003e\u003c/div\u003e\\n \u003cdiv id=\\\"c\\\"\u003e\u003c/div\u003e\\n \u003cdiv id=\\\"d\\\"\u003e\u003c/div\u003e\\n \u003cdiv id=\\\"e\\\"\u003e\u003c/div\u003e\\n \u003cdiv id=\\\"f\\\"\u003e\u003c/div\u003e\\n \u003cdiv id=\\\"g\\\"\u003e\u003c/div\u003e\\n \u003cdiv id=\\\"h\\\"\u003e\u003c/div\u003e\\n \u003cdiv id=\\\"i\\\"\u003e\u003c/div\u003e\\n \u003c/div\u003e\\n \u003cbutton\u003e再來一局!\u003c/button\u003e\\n\u003c/body\u003e\\n\u003c/html\u003e\",\"css\":\"body {\\n text-align: center;\\n}\\n\\nh1 {\\n color: #dc685a;\\n}\\n\\nbutton {\\n padding: 10px;\\n border-width: 0px;\\n border-radius: 5px;\\n margin: 15px;\\n font-size: 16px;\\n color: #fff;\\n background-color: #ecaf4f;\\n}\\n\\n.grid {\\n width: 330px;\\n height: 330px;\\n margin: auto;\\n}\\n\\n.grid div {\\n width: 100px;\\n height: 100px;\\n border-radius: 0px;\\n margin: 5px;\\n float: left;\\n line-height: 100px;\\n font-size: 4rem;\\n font-weight: bold;\\n color: #ffffff;\\n background-color: #555555;\\n text-shadow: 0px 0px 10px #999;\\n box-shadow: 0px 0px 10px #999;\\n cursor: pointer;\\n transition: 0.2s;\\n}\\n\\n.grid div:hover {\\n background-color: #333333;\\n border-radius: 10px;\\n}\",\"js\":\"\"}","created_at":"2023-07-23T19:56:40.613+08:00","updated_at":"2023-07-23T19:57:03.634+08:00","name":"【綜合練習】井字遊戲:實作 2 - 解答","language":"web","screenshot":{"url":null},"parent_id":574403,"plugin":"var current = 'O';\n\n$('.grid div').click(function () {\n if ($(this).text() == '') {\n $(this).text(current);\n if (current == 'O') {\n current = 'X';\n $(this).css('background-color', '#ecaf4f'); // 橘色\n } else {\n current = 'O';\n $(this).css('background-color', '#dc685a'); // 紅色\n }\n }\n\n var a = $('#a').text();\n var b = $('#b').text();\n var c = $('#c').text();\n var d = $('#d').text();\n var e = $('#e').text();\n var f = $('#f').text();\n var g = $('#g').text();\n var h = $('#h').text();\n var i = $('#i').text();\n check(a, b, c);\n check(d, e, f);\n check(g, h, i);\n check(a, d, g);\n check(b, e, h);\n check(c, f, i);\n check(a, e, i);\n check(c, e, g);\n});\n\nfunction check(x, y, z) {\n if (x == y \u0026\u0026 y == z \u0026\u0026 x != '') {\n $('h1').text(x + '獲勝');\n }\n}\n\n$('button').click(function () {\n $('h1').text('Tic Tac Toe');\n $('.grid div').text('');\n $('.grid div').css('background-color', ''); // 為什麼不是設定 #555 ? 因為這樣 hover 的屬性就會失效!\n});","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":29,"hashid":"meys6r4k8","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
前往網站頁面
1:1:1
1:1
full
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦