{"id":551394,"student_id":10,"content":"{\"html\":\"\u003c!DOCTYPE html\u003e\\n\u003chtml\u003e\\n\u003chead\u003e\\n\\t\u003ctitle\u003eDocument\u003c/title\u003e\\n\\t\u003cscript src=\\\"https://code.jquery.com/jquery-3.4.1.min.js\\\"\u003e\u003c/script\u003e\\n\u003c/head\u003e\\n\u003cbody\u003e\\n \u003ch1\u003e終極密碼\u003c/h1\u003e\\n \u003ctextarea disabled id=\\\"textarea\\\"\u003e\u003c/textarea\u003e\\n \u003cbr/\u003e\\n \u003cbutton id=\\\"guess\\\" class=\\\"yellow\\\"\u003e猜數字\u003c/button\u003e\\n \u003cbutton id=\\\"restart\\\" class=\\\"red\\\"\u003e開始新局\u003c/button\u003e\\n\u003c/body\u003e\\n\u003c/html\u003e\",\"css\":\"body {\\n text-align: center;\\n background-color: #25313e;\\n font-family: Arial;\\n}\\n\\nh1 {\\n color: #607489;\\n margin: 20px;\\n}\\n\\ntextarea {\\n width: 350px;\\n height: 350px;\\n padding: 15px;\\n border: 1px solid #aaa;\\n border-radius: 3px;\\n color: #ccc;\\n box-shadow: 0 0.25rem 0.5rem #12181e;\\n background-color: #191919;\\n text-align: center;\\n font-size: 16px;\\n line-height: 20px;\\n font-family: Monospace;\\n \\n}\\n\\nbutton {\\n padding: 10px;\\n color: #eee;\\n margin-top: 10px;\\n border: 1px solid #aaa;\\n border-radius: 3px;\\n box-shadow: 0 0.25rem 0.5rem #12181e;\\n font-size: 1rem;\\n}\\n\\nbutton.red {\\n background-color: #fc4048;\\n}\\n\\nbutton.yellow {\\n background-color: #fd9409;\\n}\",\"js\":\"$('#guess').click(function () {\\n var g = prompt('請輸入 0 - 1000 之間的數字?'); //讀取玩家輸入的數字\\n var r = game.guess(g); //猜答案\\n console.log(r); // 印出結果\\n});\\n\\n$('#restart').click(function () {\\n game.start(); //開始新的一局\\n});\\n\\n\\nvar low = 0;\\nvar up = 1000;\\n\"}","created_at":"2023-06-12T16:02:26.625+08:00","updated_at":"2023-06-12T16:02:26.625+08:00","name":"終極密碼(預設版) 副本","language":"web","screenshot":{"url":null},"parent_id":144209,"plugin":"var GREATER = '太小';\nvar LESS = '太大';\nvar BINGO = '答對';\n\n\nfunction Game (textareaEl) {\n this.answer = undefined;\n this.playing = false;\n this.index = 0;\n this.round = 0;\n this.sum = 0;\n \n this.buffer = '';\n \n self = this;\n \n setInterval(function () {\n if (self.buffer.length \u003e 0) {\n textareaEl.value += self.buffer;\n textareaEl.scrollTop = textareaEl.scrollHeight;\n self.buffer = ''; \n }\n }, 100);\n}\n\nGame.prototype = {\n \n start: function () {\n this.answer = Math.floor(Math.random()*1000);\n this.round++;\n this.index = 0;\n this.playing = true;\n this.buffer += `\\n========== 第${this.round}局 ==========\\n\\n`;\n },\n \n guess: function (g) {\n if (!this.playing) return;\n \n var result;\n this.index++;\n this.sum++;\n if (g \u003e this.answer) result = LESS;\n if (g \u003c this.answer) result = GREATER;\n if (g == this.answer) result = BINGO;\n\n this.buffer += `第${this.index}次\\t猜:${g}\\t結果:${result}\\n`;\n \n if (g == this.answer) {\n var avg = (this.sum / this.round).toFixed(3);\n this.buffer += `\\n總共猜 ${this.index} 次`;\n this.buffer += `\\n平均猜 ${avg} 次\\n`;\n }\n return result;\n }\n}\n\n\nvar game = new Game(document.getElementById('textarea'));","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":84,"hashid":"5j3s3yzrq","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":12582045,"file_name":"koding.png","project_id":551394,"asset_id":209457,"created_at":"2023-06-12T16:02:26.639+08:00","updated_at":"2023-06-12T16:02:26.639+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
前往網站頁面
1:1:1
1:1
full
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦