Tạo quảng cáo chạy dọc 2 bên bằng javascript.
Mã CSS chèn vào file Style Sheet style.css
<style type="text/css">
.float {
width: 120px;
height: auto;
border: solid 1px #CCCCCC;
}
</style>
Mã HTML chèn vào thân body
<div id="adleft" class="float"><a href="http://kenh360.com" TARGET="_blank"><img src="/cntt/images/qc1.jpg" border="0"></a>
</div>
<div id="adright" class="float"><a href="http://kenh360.com" target="_blank"><img src="/cntt/images/qc2.jpg" /></a>
</div>
</div>
</body>
Mã Javascript lưu thành 1 file ad.js và chèn đoạn mã sau vào cuối body
<script type="text/javascript" src="/cntt/ad.js"></script>
Mã Javascript:
<script type="text/javascript">
function setPosition(id, position) {
var store = {
ram : {
top : 0,
left : 0,
right : 0,
bottom : 0
},
rom : {
top : null,
left : null,
right : null,
bottom : null
}
};
for (var i in position) {store.rom[i] = position[i];}
var element = document.getElementById(id);
for (i in store) {element[i] = store[i];}
element.rom.move = function() {
if (window.innerHeight) {
var topPage = window.pageYOffset;
var leftPage = window.pageXOffset;
var rightPage = leftPage + window.innerWidth - element.offsetWidth;
var bottomPage = topPage + window.innerHeight - element.offsetHeight;
}
else {
var topPage = document.body.scrollTop;
var leftPage = document.body.scrollLeft;
var rightPage = leftPage + document.body.clientWidth - element.offsetWidth;
var bottomPage = topPage + document.body.clientHeight - element.offsetHeight;
}
element.style.position = "absolute";
if (element.rom.top != null) {
element.ram.top += Math.round((topPage + element.rom.top - element.ram.top)/20);
element.style.top = element.ram.top;
}
if (element.rom.left != null) {
element.ram.left += Math.round((leftPage + element.rom.left - element.ram.left)/20);
element.style.left = element.ram.left;
}
if (element.rom.right != null) {
element.ram.right += Math.round((rightPage - element.rom.right - element.ram.right)/20);
element.style.left = element.ram.right;
}
if (element.rom.bottom != null) {
element.ram.bottom += Math.round((bottomPage - element.rom.bottom - element.ram.bottom)/20);
element.style.top = element.ram.bottom;
}
setTimeout("document.getElementById('"+element.id+"').rom.move()",10);
};
element.rom.move();
}
setPosition("adright", {top: 0, left: 800});
setPosition("adleft", {top: 0, left: 0});
</script>
Sưu tầm
| Ngôn ngữ truy vấn XML - XQuery < Lùi | Tiếp theo > Tạo menu top với hiệu ứng đẹp mắt |
|---|
Tin mới hơn:
- 05/12/2009 11:02 - 13 Firefox Add-ons cho Web Development
- 22/09/2009 16:36 - mimeTeX - Hiển thị toán học trên website
- 15/07/2009 16:54 - Tool cho webmaster trong Lienket247
- 14/06/2009 18:09 - Tạo bàn phím ảo virtual keyboard trên website
- 12/06/2009 23:51 - Ngôn ngữ truy vấn XML - XQuery
Tin cũ hơn:
- 16/05/2009 00:30 - Tạo menu top với hiệu ứng đẹp mắt
- 07/05/2009 21:38 - Tạo quảng cáo hiển thị ở vị trí cố định
- 07/05/2009 21:23 - Nhúng Flash với SWFobject và AC_FL_RunContent
- 20/04/2009 22:43 - Thư viện đồ họa GD Library
- 19/04/2009 13:43 - Cài đặt Web Server XAMPP trên Linux
Download Game bóng đá PES8 Việt Nam
Tải game bóng đá FiFa 09
Tải game Dragon ball Z - 7 viên ngọc rồng
Tải Game Bóng Đá Pro Evolution Soccer 6 Việt Nam
Download PES 2011 patch Việt Nam PESVN
Tải Game Bóng Đá FIFA 2009 RIP 1 CD
Download Pro Evolution Soccer 2011
Download Game THE SIMS 3
Tải Game bóng đá PES 2009
Download PES 2011 demo
XAPPR: Biến smartphone của bạn thành khẩu súng Laser, chơi game AR
Thiết lập Hotmail POP settings trên điện thoại
[Xbox 360 FAQs] - Những điều nên biết về Xbox 360
Windows 95/98/XP chạy trên các thiết bị Android một cách dễ dàng
Hướng dẫn phục hồi dữ liệu và Fix lỗi bị treo táo của iPhone, iPod
Fifa 12 cho các máy android 2.3 trở lên
Tải game Android miễn phí
iWep Pro v4.1.3 - Tìm mật khẩu mạng WiFi trên iOS
Activator 1.6.1 Việt hóa
L.A. Noire: The Complete Edition - THETA [Full ISO/Action/2011] [13.37GB]
Download 7554 demo
Download Game PC, cập nhật liên tục (torrent)
PES 2012 ra mắt bản mở rộng đầu tiên vào 11/10
PES2012 - Full version - Ngôn ngữ và bình luận tiếng Anh
PES2012 - Blurry disable làm mịn đồ họa
PES 2011 PATCH 4.1 - TRANSFER UPDATE - RELEASED
Download Prestashop 1.5
Download PrestaShop 1.4
Bổ sung Memcached vào PrestaShop 1.4
Hướng dẫn tích hợp Ngân Lượng vào PrestaShop
Sửa lỗi invalid carrier or no carrier selected trong PrestaShop
Sửa lỗi PrestaShop: Path is not the same between your browser and you server
Cài đặt PrestaShop
Thiết kế giao diện PrestaShop Theme
Hướng dẫn cài đặt themes trong PrestaShop
Hướng dẫn cách thêm ngôn ngữ cho PrestaShop
Bộ sưu tập Giao diện Premium PrestaShop Themes chuyên nghiệp
Giới thiệu về website thương mại điện tử 2.0 Prestashop
Download PES 12 Demo
Những di động có bàn phím tốt nhất 2008 


