{"id":167969,"student_id":3469,"content":"{\"html\":\"\u003chtml\u003e\\r\\n\u003chead\u003e\\r\\n\\t\u003ctitle\u003e井字遊戲\u003c/title\u003e\\r\\n \u003cscript src=\\\"https://code.jquery.com/jquery-3.2.1.min.js\\\"\u003e\u003c/script\u003e\\r\\n\u003c/head\u003e\\r\\n\u003cbody\u003e\\r\\n \u003ch1\u003eTic Tac Toe\u003c/h1\u003e\\r\\n \u003cdiv class=\\\"grid\\\"\u003e\\r\\n \u003cdiv id=\\\"a\\\" class=\\\"gray\\\"\u003e\u003c/div\u003e\\r\\n \u003cdiv id=\\\"b\\\" class=\\\"gray\\\"\u003e\u003c/div\u003e\\r\\n \u003cdiv id=\\\"c\\\" class=\\\"gray\\\"\u003e\u003c/div\u003e\\r\\n \u003cdiv id=\\\"d\\\" class=\\\"gray\\\"\u003e\u003c/div\u003e\\r\\n \u003cdiv id=\\\"e\\\" class=\\\"gray\\\"\u003e\u003c/div\u003e\\r\\n \u003cdiv id=\\\"f\\\" class=\\\"gray\\\"\u003e\u003c/div\u003e\\r\\n \u003cdiv id=\\\"g\\\" class=\\\"gray\\\"\u003e\u003c/div\u003e\\r\\n \u003cdiv id=\\\"h\\\" class=\\\"gray\\\"\u003e\u003c/div\u003e\\r\\n \u003cdiv id=\\\"i\\\" class=\\\"gray\\\"\u003e\u003c/div\u003e\\r\\n \u003c/div\u003e\\r\\n \u003cbutton\u003e再來一局!\u003c/button\u003e\\r\\n\u003c/body\u003e\\r\\n\u003c/html\u003e\\r\\n\",\"css\":\"body {\\r\\n text-align: center;\\r\\n}\\r\\n\\r\\nh1 {\\r\\n color: #dc685a;\\r\\n}\\r\\n\\r\\nbutton {\\r\\n padding: 10px;\\r\\n border-width: 0px;\\r\\n border-radius: 5px;\\r\\n margin: 15px;\\r\\n font-size: 16px;\\r\\n color: #fff;\\r\\n background-color: #ecaf4f;\\r\\n}\\r\\n\\r\\n/* 設定格子大小,並使他置中*/\\r\\n.grid {\\r\\n width: 330px;\\r\\n height: 330px;\\r\\n margin: auto;\\r\\n}\\r\\n\\r\\n.grid div {\\r\\n /*改變顏色時有1.5s的漸層↓*/\\r\\n transition: 1.5s;\\r\\n font-size: 60px;\\r\\n font-weight: bold;\\r\\n color: #ffffff;\\r\\n text-shadow: 0px 0px 15px #fff999;\\r\\n box-shadow: 0px 0px 15px #999fff;\\r\\n border-radius: 10px;\\r\\n \\r\\n /*將div設為正方形大小*/\\r\\n width: 100px;\\r\\n height: 100px;\\r\\n margin: 5px;\\r\\n\\r\\n \\r\\n /*透過浮動,使div不會直接換行*/\\r\\n float: left;\\r\\n /*設定行高跟正方形一樣高,使字的可以在格子上下位置的中間*/\\r\\n line-height: 100px;\\r\\n /*使指標碰到格子時,變換樣式*/\\r\\n\\r\\n \\r\\n}\\r\\n \\r\\n\\r\\n\\r\\n.gray{\\r\\n background-color: #555555;\\r\\n\\r\\n}\\r\\n.gray:hover {\\r\\n background-color: #333333;\\r\\n}\\r\\n\\r\\n.orange {\\r\\n background-color: #ecaf4f ;\\r\\n}\\r\\n\\r\\n.red {\\r\\n background-color: #dc685a ;\\r\\n}\\r\\n\",\"js\":\"var current = 'O';\\nvar win = false;\\n\\n\\n$('.grid div').click(place);\\n\\n\\nfunction place() {\\n\\n\\n\\n var thisWard = $(this).text();\\n if (thisWard === '') {\\n if (win == false) {\\n\\n $(this).text(current);\\n if (current == 'O') {\\n current = 'X';\\n $(this).removeClass('gray');\\n $(this).addClass('orange');\\n } else {\\n current = 'O';\\n $(this).removeClass('gray');\\n $(this).addClass('red');\\n }\\n }\\n\\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\\n //直線\\n check(a, b, c);\\n check(d, e, f);\\n check(g, h, i);\\n //橫線\\n check(a, d, g);\\n check(b, e, h);\\n check(c, f, i);\\n //斜線\\n check(a, e, i);\\n check(c, e, g);\\n\\n\\n }\\n\\n}\\n\\n\\nfunction check(x, y, z) {\\n if (x == y \u0026\u0026 y == z \u0026\u0026 x != '') {\\n $('h1').text(x + '獲勝');\\n win = true;\\n }\\n}\\n\\n\\n$('button').click(restart);\\n\\nfunction restart() {\\n $('h1').text('Tic Tac Toe');\\n $('.grid div').text('');\\n $('.grid div').removeClass('red');\\n $('.grid div').removeClass('orange');\\n $('.grid div').addClass('gray');\\n win = false;\\n}\"}","created_at":"2020-07-19T13:36:37.250+08:00","updated_at":"2020-08-16T14:25:29.507+08:00","name":"井字遊戲(S) 副本","language":"web","screenshot":{"url":"https://cdn0.koding.school/uploads/project/screenshot/167969/a200451524c77160e7932595b04e2ba2.jpg"},"parent_id":76659,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":89,"hashid":"p93sg4gv","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
到這台電腦