about summary refs log tree commit diff
path: root/usth/ICT3.2/prac/1/task11.js
diff options
context:
space:
mode:
Diffstat (limited to 'usth/ICT3.2/prac/1/task11.js')
-rw-r--r--usth/ICT3.2/prac/1/task11.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/usth/ICT3.2/prac/1/task11.js b/usth/ICT3.2/prac/1/task11.js
new file mode 100644
index 0000000..55d7eba
--- /dev/null
+++ b/usth/ICT3.2/prac/1/task11.js
@@ -0,0 +1,17 @@
+const files = {'cat': ['lick-vet-penis.png', 'lsd-dragon.jpg',
+                       'nailed-moonwalk.gif', 'not-exist.jpg',
+                       'oh.gif', 'ooer.jpg', 'pan.jpg'],
+               'communist': ['black-hole.png', 'harry.jpg',
+                             'nike.jpg', 'propaganda.jpg', 'sky.jpg'],
+               'dog': ['centipede.png', 'couple.jpg', 'deliver.jpg',
+                       'fight.gif', 'hit-karate-dad.jpg', 'pic.jpg']}
+
+function cb(id) {
+    let content = '<p>My name is Nguyễn Gia Phong<p>';
+    if (id != 'about')
+        content = files[id].map(file => `
+            <a href='images/${id}/${file}' target='_blank'>
+              <img src='images/${id}/${file}'>
+            </a>`).join('');
+    return () => document.getElementById('foobar').innerHTML = content;
+}