huai-sian 3 years ago
parent
commit
c0ab5b1a2a
3 changed files with 7 additions and 6 deletions
  1. BIN
      img/upload_img.png
  2. 1 0
      styleMV.css
  3. 6 6
      test.html

BIN
img/upload_img.png


+ 1 - 0
styleMV.css

@@ -712,6 +712,7 @@ footer {
   background-color: #75a7dd;
   background-position: center;
   background-size: cover;
+  background-image: url(./img/upload_img.png);
   color: white;
   padding: 0.4rem 0.5rem;
   font-size: 0.9rem;

+ 6 - 6
test.html

@@ -40,6 +40,9 @@
         background-repeat: no-repeat;
         border-radius: 1rem;
       }
+      #msform .img-inputTest {
+        text-align: end;
+      }
     </style>
 </head>
 
@@ -394,19 +397,17 @@
             console.log(jsonData.msg);
             $(this).prev().val(jsonData.msg);
             const nextEl = event.target.nextSibling;
-            nextEl.innerHTML = '';
-            nextEl.textContent = '上傳檔案';
             nextEl.style.backgroundImage = `url(http://${jsonData.msg})`;
             // nextEl.style.backgroundImage = `url(https://cdn2.ettoday.net/images/6017/d6017847.jpg)`;
             // nextEl.nextSibling.classList.add('box-active');
             // nextEl.nextSibling.style.backgroundImage = `url(http://${jsonData.msg})`;
             //console.log($(this).next());
-            //$(this).next().html('上傳檔案');
+            //$(this).next().html('');
             //$(this).next().text('上傳檔案');
           },
           error: function (error) {
-            event.target.nextSibling.nextSibling.innerHTML = '';
-            event.target.nextSibling.nextSibling.textContent = '上傳檔案';
+            const nextEl = event.target.nextSibling;
+            nextEl.style.backgroundImage = `url(./img/upload_img.png)`;
             alert('圖片錯誤');
           }
         });
@@ -727,7 +728,6 @@
         var imguploadlabel = document.createElement("label");
         imguploadlabel.setAttribute('for', `img${i}`);
         imguploadlabel.classList.add('upload-btn');
-        imguploadlabel.textContent = '上傳圖片';
         imguploadlabel.setAttribute('set-lan', `html:upload_file`);
         img_box.appendChild(imguploadlabel);
         imgupload.addEventListener('change', prepareUpload);