Gốc > Chia sẻ kinh nghiệm > Web - Blog >
Vũ Ngọc Hải Bằng @ 19:12 27/11/2012
Số lượt xem: 10215
Code thay hình ảnh trỏ chuột cho web.
Demo: Trỏ chuột trên trang 3V này.
Thầy Cô copy code và dán vào bất kỳ đâu trên trang riêng violet.
<style type="text/css">
a:hover
{
text-decoration: none;
background: url("http://bangvu.net/2trochuot/link.gif");
background-position: bottom bottom;
cursor : url("http://bangvu.net/2trochuot/link.cur"), progress;
}
HTML,BODY{cursor: url("http://bangvu.net/2trochuot/clovel.cur"), progress;}
</style>
Nếu muốn thay đổi trỏ chuột thì Thầy Cô thay link đến một file trỏ chuột dạng .cur là xong
Chúc Thầy Cô vui vẻ !
Vũ Ngọc Hải Bằng @ 19:12 27/11/2012
Số lượt xem: 10215
Số lượt thích:
0 người
- Code tạo menu cố định cuối trang. (07/10/12)
- Ba dãy ô vuông 3 màu bay quanh chuột (06/10/12)
- Tim bay từ trỏ chuột lên trên. (06/10/12)
- Cờ Việt Nam tung bay trong ... web. (06/10/12)
- Tùy biến menu hai bên web !!! (10/05/12)
BV ơi! Chị không biết kàm sao có link dạng.cur ( có điều kiện thì HD chị) Cho chị xin bài này nhen BV.Chúc em vui
Bài này để thay con trỏ chuột chị ạ !
Chị muốn thêm hình bông hoa đó vào trỏ chuột thì dùng code này nhé:
<script type="text/javascript">
var trailimage=["http://d2.violet.vn/uploads/resources/630/HOACUOI.gif", 40, 38] //image path, plus width and height
var offsetfrommouse=[15,10] //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var displayduration=0 //duration in seconds image should remain visible. 0 for always.
if (document.getElementById || document.all)
document.write('<div id="trailimageid" style="position:absolute;visibility:visible;left:0px;top:0px;width:1px;height:1px"><img src="'+trailimage[0]+'" border="0" width="'+trailimage[1]+'px" height="'+trailimage[2]+'px"><\/div>')
function gettrailobj(){
if (document.getElementById)
return document.getElementById("trailimageid").style
else if (document.all)
return document.all.trailimagid.style
}
function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function hidetrail(){
gettrailobj().visibility="hidden"
document.onmousemove=""
}
function followmouse(e){
var xcoord=offsetfrommouse[0]
var ycoord=offsetfrommouse[1]
if (typeof e != "undefined"){
xcoord+=e.pageX
ycoord+=e.pageY
}
else if (typeof window.event !="undefined"){
xcoord+=truebody().scrollLeft+event.clientX
ycoord+=truebody().scrollTop+event.clientY
}
var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)
if (xcoord+trailimage[1]+3>docwidth || ycoord+trailimage[2]> docheight)
gettrailobj().display="none"
else
gettrailobj().display=""
gettrailobj().left=xcoord+"px"
gettrailobj().top=ycoord+"px"
}
document.onmousemove=followmouse
if (displayduration>0)
setTimeout("hidetrail()", displayduration*1000)
</script>
Sẵn có hình đẹp, em "tận dụng" luôn chị nhá !
Cảm ơn chị đã thường ghé thăm em !
Chào BV! 2 khách và 1 thành viên
Em chào chị TN !
Cảm ơn chị nhiều về lời chúc tốt đẹp. 
BV ơi! Sao con trỏ chuột trang chị mất tiêu đầu xanh như trỏ chuột của em rồi. Khi nào rãnh qua trang chị xem dùm chị nhen. Chị cám ơn em nhiều!
Trỏ chuột trang BV vừa đầu xanh mà có hoa mà! Của em 3 trong 1 đó (Trỏ chuột xanh , có bàn tay trắng và hoa mặt cười) của chị không đủ như thế. Thôi khuya rồi em ngủ đi Chúc em ngủ ngon. Cám ơn em nhiều lắm!
Vậy là được rồi em à! Trỏ chuột của chị giờ là 4 trong 1. hi hi! Cám ơn em nhiều.Em ngủ đi mai còn đi dạy nữa đó!
Dạ, em ngủ đây. Chúc chị ngủ ngon !
BẰNG VŨ À , THẬT TIẾC VÌ SÁNG THỨ BẢY CHỊ CÓ VIỆC ĐI XA NÊN KHÔNG ĐI CAFE ĐƯỢC CÙNG EM VÀ THẦY H.ÂN . MONG MỘT DỊP NÀO HAI CHỊ EM MÌNH SẼ CÓ DỊP HỘI NGỘ !
CHÚC EM THÊM NHIỀU NGÀY VUI BÊN NHỮNG NGƯỜI YÊU THƯƠNG !
CHO CHỊ XIN NHỮNG TƯ LIỆU NÀY VỀ TRANG TRÍ THÊM TRANG NHÀ NHE ! CÁM ƠN EM NHIỀU LẮM !
Huynh BV thật tuyệt. Đệ khâm phục huynh