ming 4 anni fa
parent
commit
3acff3d5bc
1 ha cambiato i file con 13 aggiunte e 6 eliminazioni
  1. 13 6
      index2.html

+ 13 - 6
index2.html

@@ -69,7 +69,7 @@
       <!-- fieldsets -->
       <fieldset>
         <h2 class="fs-title">AI ANCHOR</h2>
-        <h3 class="fs-subtitle">標題</h3>
+        <h3 id=title class="fs-subtitle">標題</h3>
         <input type="text" name='t1' class='title_new' value="" placeholder="1" /> <br/>
         <h3 class="fs-subtitle">台詞</h3>
         <input type="text" name='t1' class='txtsrc1' value="" placeholder="1" /> <br/>
@@ -133,11 +133,18 @@
       document.getElementById("mySidenav").style.width = "0";
     }
     function load_data(id){
-      var filtered = loaded_data.filter(function (item) {
-        return item.id === id;
-      });
-      alert(filtered.title);
-
+      var obj = loaded_data.find(item => item.id === id)
+      var title = document.getElementById("title")
+      title.innerHTML = obj.title;
+      var step;
+      for (step = 1; step <= 10; step++) {
+        $(".txtsrc"+step).val() = obj.text_content[step-1]
+      }
+      var step2;
+      for (step2 = 1; step2 <= 10; step2++) {
+        $(".imgsrc"+step2).val() = obj.img_urls[step2-1]
+      }
+      
     }
     </script>
   <style>