diff --git "a/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 1/index.html" "b/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 1/index.html" new file mode 100644 index 0000000..c52008a --- /dev/null +++ "b/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 1/index.html" @@ -0,0 +1,74 @@ + + + + + + Shop Thingy - saku + + + + + + + + +
+
+

My Shop

+

ร้านค้าของพวกเราได้ทำการขายเสื้อสีเทาหลายขนาด

+ +
+
+

+

Gray Shirt

+

+
+
+ +

Price ฿399

+

Amount Left: 3

+ +
+
+ +
+
+

+

Cotton Gray Shirt

+

+
+
+ +

Price ฿299

+

Amount Left: 3

+ +
+
+ +
+
+

+

Gray Shirt Set

+

+
+
+ +

Price ฿499

+

Amount Left: 3

+ +
+
+ + +
+
+ + + + \ No newline at end of file diff --git "a/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 1/script.js" "b/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 1/script.js" new file mode 100644 index 0000000..141dd8d --- /dev/null +++ "b/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 1/script.js" @@ -0,0 +1,68 @@ +// Total Product Amount +let productAmount1 = 3; +let productAmount2 = 3; +let productAmount3 = 3; + +// Amount Left Displays and Buy Buttons +const amountLeft1 = document.getElementById("amountLeft1"); +const buyButton1 = document.getElementById("buyButton1"); + +const amountLeft2 = document.getElementById("amountLeft2"); +const buyButton2 = document.getElementById("buyButton2"); + +const amountLeft3 = document.getElementById("amountLeft3"); +const buyButton3 = document.getElementById("buyButton3"); + +// Product Names +const productName1 = document.getElementById("productName1"); +const productName2 = document.getElementById("productName2"); +const productName3 = document.getElementById("productName3"); + +// Button Event +buyButton1.addEventListener('click', function () { + + amountLeft1.innerHTML = productAmount1; + productAmount1--; + + if (productAmount1 > 0) { + amountLeft1.innerHTML = productAmount1; + alert(`คุณได้ซื้อสินค้า ${productName1.textContent} อย่างสำเร็จ!\nสินค้าเหลืออยู่ ${productAmount1} ตัว`); + } else { + amountLeft1.innerHTML = "Sold Out!"; + buyButton1.style.display = "none"; + alert(`คุณได้ซื้อสินค้า ${productName1.textContent} อย่างสำเร็จ!\nสินค้านี้หมดแล้ว!`); + } + +}); + +buyButton2.addEventListener('click', function () { + + amountLeft2.innerHTML = productAmount2; + productAmount2--; + + if (productAmount2 > 0) { + amountLeft2.innerHTML = productAmount2; + alert(`คุณได้ซื้อสินค้า ${productName2.textContent} อย่างสำเร็จ!\nสินค้าเหลืออยู่ ${productAmount2} ตัว`); + } else { + amountLeft2.innerHTML = "Sold Out!"; + buyButton2.style.display = "none"; + alert(`คุณได้ซื้อสินค้า ${productName2.textContent} อย่างสำเร็จ!\nสินค้านี้หมดแล้ว!`); + } + +}); + +buyButton3.addEventListener('click', function () { + + amountLeft3.innerHTML = productAmount3; + productAmount3--; + + if (productAmount3 > 0) { + amountLeft3.innerHTML = productAmount3; + alert(`คุณได้ซื้อสินค้า ${productName3.textContent} อย่างสำเร็จ!\nสินค้าเหลืออยู่ ${productAmount3} ตัว`); + } else { + amountLeft3.innerHTML = "Sold Out!"; + buyButton3.style.display = "none"; + alert(`คุณได้ซื้อสินค้า ${productName3.textContent} อย่างสำเร็จ!\nสินค้านี้หมดแล้ว!`); + } + +}); \ No newline at end of file diff --git "a/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 1/shop-images/080bbf5373c3f9d88114ee6228aa6b42b2d27c9b_xxl-1.jpg" "b/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 1/shop-images/080bbf5373c3f9d88114ee6228aa6b42b2d27c9b_xxl-1.jpg" new file mode 100644 index 0000000..9619ecd Binary files /dev/null and "b/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 1/shop-images/080bbf5373c3f9d88114ee6228aa6b42b2d27c9b_xxl-1.jpg" differ diff --git "a/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 1/shop-images/572e60a0d03f6c21f6b71fd595ae78259818b9a4_xxl-1.jpg" "b/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 1/shop-images/572e60a0d03f6c21f6b71fd595ae78259818b9a4_xxl-1.jpg" new file mode 100644 index 0000000..26a85ac Binary files /dev/null and "b/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 1/shop-images/572e60a0d03f6c21f6b71fd595ae78259818b9a4_xxl-1.jpg" differ diff --git "a/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 1/shop-images/re_1_2_12.jpg" "b/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 1/shop-images/re_1_2_12.jpg" new file mode 100644 index 0000000..1404374 Binary files /dev/null and "b/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 1/shop-images/re_1_2_12.jpg" differ diff --git "a/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 2/index.html" "b/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 2/index.html" new file mode 100644 index 0000000..5f82336 --- /dev/null +++ "b/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 2/index.html" @@ -0,0 +1,113 @@ + + + + + + Form - saku + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

แบบฟอร์ม

+ + + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+ โสด + +
+
+ มีแฟน + +
+
+ แต่งงานแล้ว + +
+
+ หม้าย + +
+
+ +
+ + +
+ +
+ + +
+ + +
+
+
+ + \ No newline at end of file diff --git "a/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 2/script.js" "b/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 2/script.js" new file mode 100644 index 0000000..bd428ae --- /dev/null +++ "b/2024/Mid Semester Test/\340\270\202\340\271\211\340\270\255 2/script.js" @@ -0,0 +1,10 @@ +// Elements +const form = document.getElementById("form"); +const successPrompt = document.getElementById("successPrompt"); + +form.addEventListener('submit', function(event) { + event.preventDefault(); // Prevent from refreshing + + form.style.display = "none"; + successPrompt.style.display = "block"; +}); \ No newline at end of file