ยินดีต้อนรับคุณ, บุคคลทั่วไป กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน

เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น

ThaiSEOBoard.comความรู้ทั่วไปGeneral (ถามคุยวิชาการ IM)ขอโค๊ดแบนเนอร์หน้าเว็บแบบนี้หน่อยครับ
หน้า: [1]   ลงล่าง
พิมพ์
ผู้เขียน หัวข้อ: ขอโค๊ดแบนเนอร์หน้าเว็บแบบนี้หน่อยครับ  (อ่าน 1679 ครั้ง)
0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้
surasak991111
ก๊วนเสียว
*

พลังน้ำใจ: 6
ออฟไลน์ ออฟไลน์

กระทู้: 454



ดูรายละเอียด
« เมื่อ: 30 พฤษภาคม 2020, 01:14:12 »

ไม่ทราบทำอย่างไรครับอยากได้แบบนี้ ขอบคุณครับ

บันทึกการเข้า

BOS
ก๊วนเสียว
*

พลังน้ำใจ: 33
ออฟไลน์ ออฟไลน์

กระทู้: 459



ดูรายละเอียด เว็บไซต์
« ตอบ #1 เมื่อ: 30 พฤษภาคม 2020, 09:23:49 »

โค๊ด:
(function(image,link){
  var img = document.createElement("img");
  img.src = image;
  img.onload = function() {
    var imgWidth = this.naturalWidth;
    var imgHeight = this.naturalHeight;
    var banner = document.createElement("div");
    var inner = document.createElement("div");
    var aLink = document.createElement("a");
    var btnX = document.createElement("button");
    banner.style.cssText = "position:fixed;bottom:0;left:0;right:0;";
    inner.style.cssText = "margin:0 auto;width:"+imgWidth+"px;height:"+imgHeight+"px;position:relative;";
    aLink.href = link;
    aLink.target = "_blank";
    aLink.style.cssText = "text-decoration:none;display:block;width:100%;height:100%;";
    btnX.type = "button";
    btnX.innerHTML = "<b>X</b>";
    btnX.style.cssText = "outline:0;border:0;border-radius:0;background:#fff;color:#f00;width:26px;height:26px;position:absolute;top:0;right:-26px;";
    aLink.appendChild(img);
    inner.appendChild(aLink);
    inner.appendChild(btnX);
    banner.appendChild(inner);
    document.body.appendChild(banner);
    btnX.onmouseover = function() {
      this.style.background = "#f00";
      this.style.color = "#fff";
    }
    btnX.onmouseout = function() {
      this.style.background = "#fff";
      this.style.color = "#f00";
    }
    btnX.onclick = function() {
      banner.style.display = "none";
    }
  }
})("https://60ss.github.io/img/728x100.png","https://www.mechords.com");
ref. https://codepen.io/60ss/pen/ZEbgpVG
« แก้ไขครั้งสุดท้าย: 30 พฤษภาคม 2020, 09:27:40 โดย BOS » บันทึกการเข้า

surasak991111
ก๊วนเสียว
*

พลังน้ำใจ: 6
ออฟไลน์ ออฟไลน์

กระทู้: 454



ดูรายละเอียด
« ตอบ #2 เมื่อ: 30 พฤษภาคม 2020, 12:22:28 »

โค๊ด:
(function(image,link){
  var img = document.createElement("img");
  img.src = image;
  img.onload = function() {
    var imgWidth = this.naturalWidth;
    var imgHeight = this.naturalHeight;
    var banner = document.createElement("div");
    var inner = document.createElement("div");
    var aLink = document.createElement("a");
    var btnX = document.createElement("button");
    banner.style.cssText = "position:fixed;bottom:0;left:0;right:0;";
    inner.style.cssText = "margin:0 auto;width:"+imgWidth+"px;height:"+imgHeight+"px;position:relative;";
    aLink.href = link;
    aLink.target = "_blank";
    aLink.style.cssText = "text-decoration:none;display:block;width:100%;height:100%;";
    btnX.type = "button";
    btnX.innerHTML = "<b>X</b>";
    btnX.style.cssText = "outline:0;border:0;border-radius:0;background:#fff;color:#f00;width:26px;height:26px;position:absolute;top:0;right:-26px;";
    aLink.appendChild(img);
    inner.appendChild(aLink);
    inner.appendChild(btnX);
    banner.appendChild(inner);
    document.body.appendChild(banner);
    btnX.onmouseover = function() {
      this.style.background = "#f00";
      this.style.color = "#fff";
    }
    btnX.onmouseout = function() {
      this.style.background = "#fff";
      this.style.color = "#f00";
    }
    btnX.onclick = function() {
      banner.style.display = "none";
    }
  }
})("https://60ss.github.io/img/728x100.png","https://www.mechords.com");
ref. https://codepen.io/60ss/pen/ZEbgpVG

ไม่ทราบว่าต้องไปวางที่ไหนหรอครับ ขอบคุณครับ
บันทึกการเข้า

darkfuryx11
Newbie
*

พลังน้ำใจ: 0
ออฟไลน์ ออฟไลน์

กระทู้: 92



ดูรายละเอียด เว็บไซต์
« ตอบ #3 เมื่อ: 30 พฤษภาคม 2020, 16:09:17 »

thankj
บันทึกการเข้า

ลิ้งเกินจำนวน
BOS
ก๊วนเสียว
*

พลังน้ำใจ: 33
ออฟไลน์ ออฟไลน์

กระทู้: 459



ดูรายละเอียด เว็บไซต์
« ตอบ #4 เมื่อ: 30 พฤษภาคม 2020, 21:39:41 »

ไม่ทราบว่าต้องไปวางที่ไหนหรอครับ ขอบคุณครับ

วางไว้ในหน้าที่จะให้แบนเนอร์แสดง ส่วนไหนก็ได้ครับ
ง่ายสุดก็ หลัง <body> หรือ ก่อน </body> ครับ
โค๊ด:
<script>
  (function(image,link){
    var img = document.createElement("img");
    img.src = image;
    img.onload = function() {
      var imgWidth = this.naturalWidth;
      var imgHeight = this.naturalHeight;
      var banner = document.createElement("div");
      var inner = document.createElement("div");
      var aLink = document.createElement("a");
      var btnX = document.createElement("button");
      banner.style.cssText = "position:fixed;bottom:0;left:0;right:0;";
      inner.style.cssText = "margin:0 auto;width:" imgWidth "px;height:" imgHeight "px;position:relative;";
      aLink.href = link;
      aLink.target = "_blank";
      aLink.style.cssText = "text-decoration:none;display:block;width:100%;height:100%;";
      btnX.type = "button";
      btnX.innerHTML = "<b>X</b>";
      btnX.style.cssText = "outline:0;border:0;border-radius:0;background:#fff;color:#f00;width:26px;height:26px;position:absolute;top:0;right:-26px;";
      aLink.appendChild(img);
      inner.appendChild(aLink);
      inner.appendChild(btnX);
      banner.appendChild(inner);
      document.body.appendChild(banner);
      btnX.onmouseover = function() {
        this.style.background = "#f00";
        this.style.color = "#fff";
      }
      btnX.onmouseout = function() {
        this.style.background = "#fff";
        this.style.color = "#f00";
      }
      btnX.onclick = function() {
        banner.style.display = "none";
      }
    }
  })("https://60ss.github.io/img/728x100.png","https://www.mechords.com");
</script>
บันทึกการเข้า

awordmart
คนรักเสียว
*

พลังน้ำใจ: 2
ออฟไลน์ ออฟไลน์

กระทู้: 138



ดูรายละเอียด เว็บไซต์
« ตอบ #5 เมื่อ: 30 พฤษภาคม 2020, 21:56:32 »

ขอยืมไปใช้ด้วยนะครับ  wanwan003
บันทึกการเข้า

surasak991111
ก๊วนเสียว
*

พลังน้ำใจ: 6
ออฟไลน์ ออฟไลน์

กระทู้: 454



ดูรายละเอียด
« ตอบ #6 เมื่อ: 31 พฤษภาคม 2020, 20:55:14 »

ไม่ทราบว่าต้องไปวางที่ไหนหรอครับ ขอบคุณครับ

วางไว้ในหน้าที่จะให้แบนเนอร์แสดง ส่วนไหนก็ได้ครับ
ง่ายสุดก็ หลัง <body> หรือ ก่อน </body> ครับ
โค๊ด:
<script>
  (function(image,link){
    var img = document.createElement("img");
    img.src = image;
    img.onload = function() {
      var imgWidth = this.naturalWidth;
      var imgHeight = this.naturalHeight;
      var banner = document.createElement("div");
      var inner = document.createElement("div");
      var aLink = document.createElement("a");
      var btnX = document.createElement("button");
      banner.style.cssText = "position:fixed;bottom:0;left:0;right:0;";
      inner.style.cssText = "margin:0 auto;width:" imgWidth "px;height:" imgHeight "px;position:relative;";
      aLink.href = link;
      aLink.target = "_blank";
      aLink.style.cssText = "text-decoration:none;display:block;width:100%;height:100%;";
      btnX.type = "button";
      btnX.innerHTML = "<b>X</b>";
      btnX.style.cssText = "outline:0;border:0;border-radius:0;background:#fff;color:#f00;width:26px;height:26px;position:absolute;top:0;right:-26px;";
      aLink.appendChild(img);
      inner.appendChild(aLink);
      inner.appendChild(btnX);
      banner.appendChild(inner);
      document.body.appendChild(banner);
      btnX.onmouseover = function() {
        this.style.background = "#f00";
        this.style.color = "#fff";
      }
      btnX.onmouseout = function() {
        this.style.background = "#fff";
        this.style.color = "#f00";
      }
      btnX.onclick = function() {
        banner.style.display = "none";
      }
    }
  })("https://60ss.github.io/img/728x100.png","https://www.mechords.com");
</script>

ขอบคุณครับ
บันทึกการเข้า

surasit_exceptional
Newbie
*

พลังน้ำใจ: 0
ออฟไลน์ ออฟไลน์

กระทู้: 23



ดูรายละเอียด เว็บไซต์
« ตอบ #7 เมื่อ: 31 พฤษภาคม 2020, 23:01:13 »

หืออออ  wanwan017 wanwan017
บันทึกการเข้า

<a href "www.exceptionaltech.co.th " >Structural Engineering</a>
artemis3
สมุนแก๊งเสียว
*

พลังน้ำใจ: 10
ออฟไลน์ ออฟไลน์

กระทู้: 788



ดูรายละเอียด เว็บไซต์
« ตอบ #8 เมื่อ: 31 พฤษภาคม 2020, 23:22:18 »

ขอบคุณครับ
บันทึกการเข้า

Natth40
ก๊วนเสียว
*

พลังน้ำใจ: 9
ออฟไลน์ ออฟไลน์

กระทู้: 422



ดูรายละเอียด เว็บไซต์
« ตอบ #9 เมื่อ: 01 มิถุนายน 2020, 11:25:52 »

ขอไปใช้บ้าง
บันทึกการเข้า

milleniume
คนรักเสียว
*

พลังน้ำใจ: 3
ออฟไลน์ ออฟไลน์

กระทู้: 144



ดูรายละเอียด
« ตอบ #10 เมื่อ: 02 มิถุนายน 2020, 15:48:31 »

โค๊ด:
(function(image,link){
  var img = document.createElement("img");
  img.src = image;
  img.onload = function() {
    var imgWidth = this.naturalWidth;
    var imgHeight = this.naturalHeight;
    var banner = document.createElement("div");
    var inner = document.createElement("div");
    var aLink = document.createElement("a");
    var btnX = document.createElement("button");
    banner.style.cssText = "position:fixed;bottom:0;left:0;right:0;";
    inner.style.cssText = "margin:0 auto;width:"+imgWidth+"px;height:"+imgHeight+"px;position:relative;";
    aLink.href = link;
    aLink.target = "_blank";
    aLink.style.cssText = "text-decoration:none;display:block;width:100%;height:100%;";
    btnX.type = "button";
    btnX.innerHTML = "<b>X</b>";
    btnX.style.cssText = "outline:0;border:0;border-radius:0;background:#fff;color:#f00;width:26px;height:26px;position:absolute;top:0;right:-26px;";
    aLink.appendChild(img);
    inner.appendChild(aLink);
    inner.appendChild(btnX);
    banner.appendChild(inner);
    document.body.appendChild(banner);
    btnX.onmouseover = function() {
      this.style.background = "#f00";
      this.style.color = "#fff";
    }
    btnX.onmouseout = function() {
      this.style.background = "#fff";
      this.style.color = "#f00";
    }
    btnX.onclick = function() {
      banner.style.display = "none";
    }
  }
})("https://60ss.github.io/img/728x100.png","https://www.mechords.com");
ref. https://codepen.io/60ss/pen/ZEbgpVG

เราจะเอาไปใส่ในจูมล่าได้มั้ยครับ หรือมีวิธีไหนบ้างที่จะนำไปใส่ในจูมล่า3.8 ครับ
บันทึกการเข้า
หน้า: [1]   ขึ้นบน
พิมพ์