File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed
Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ const changeTitleButton = document.getElementById('changeButton')
1717function changeTitle ( ) {
1818 let titleDiv = document . getElementById ( 'title' )
1919 console . log ( "title 抓取如下:" , titleDiv )
20- let message = '報告阿柴, 標題已經切換!'
20+ let message = '標題已經切換!'
2121 titleDiv . innerHTML = `<p>${ message } </p>`
2222 titleDiv . style . color = `blue`
2323}
Original file line number Diff line number Diff line change 11/*
2- 剪刀石頭布 🚀🔥
2+ 剪刀石頭布
33此專案涵蓋的概念
44👉 迴圈
55👉 DOM 操作
Original file line number Diff line number Diff line change 1+ /*
2+ 這是一個透過 Dog CEO API 獲取隨機狗狗圖片的非同步應用程式。
3+ 主要是 Fetch API 的使用、Promise 處理(async/await)以及基礎的 DOM 操作。
4+ */
15const dogImageDiv = document . getElementById ( 'dogImage' )
26const dogButton = document . getElementById ( 'dogButton' )
37
@@ -7,7 +11,7 @@ const getNewDog = async() => {
711 try {
812 const response = await fetch ( 'https://dog.ceo/api/breeds/image/random' )
913 const json = await response . json ( )
10- // 在接收資料(GET)時,我們常呼叫 response.json(),這其實就是瀏覽器內建幫你做好了 JSON.parse() 的工作。
14+ // 在接收資料(GET)時,經常會呼叫 response.json(),這其實就是瀏覽器內建幫你做好了 JSON.parse() 的工作。
1115 dogImageDiv . innerHTML = `<img src='${ json . message } '>`
1216 console . log ( '載入完成!' )
1317 } catch ( error ) {
You can’t perform that action at this time.
0 commit comments