Thứ Ba, 24 tháng 7, 2018

Code tạo Button Ẩn/ Hiện nội dung cho Blogspot | Tối Ưu Blogspot

Nhiều khi bạn muốn sử dụng một đoạn nội dung ẩn thi không cần thiết, chỉ hiện ra khi người dùng muốn đọc chúng. Vì vậy, bạn cần sử dụng một đoạn Code tạo Button làm ẩn hiện nội dung đó. Blog Sơn Pro đã tạo thành công, bạn hay sử dụng ngay nhé. Chúc bạn thành công!
Code tạo Button Ẩn/ Hiện nội dung cho Blogspo


TẠO BUTTON ẨN HIỆN NỘI DUNG CHO BLOGSPOT


Demo:



I AM SON PRO


Cách làm:

Bạn chèn đoạn cuối dưới đây vào bất kì chỗ nào mà bạn muốn hiển thị chúng.
<div>
<div>
<input type="button" value="Xem" style="width:75px; font-size:11px; margin:0px; padding:4px; border="1"" onclick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = 'Ẩn'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Xem'; }">
</div>
<div>
<div style="display: none;  border:#4F4F4F 1px solid; padding: 4px; background:# ">
NỘI_DUNG
</div>
</div>

Key: tạo nút ẩn hiện nội dung cho blogspot, button ẩn hiện cho blogspot

NEXT ARTICLE Next Post
This Is The Oldest Page
NEXT ARTICLE Next Post
This Is The Oldest Page
 
banner

Delivered by FeedBurner