懂视1
懂视101
懂视201
懂视301
懂视401
懂视501
懂视601
懂视701
懂视801
懂视901
懂视1001
懂视1101
懂视1201
懂视1301
懂视1401
懂视1501
懂视1601
懂视1701
懂视1801
懂视1901
文库1
文库101
文库201
文库301
文库401
文库501
文库601
文库701
文库801
文库901
文库1001
文库1101
文库1201
文库1301
文库1401
文库1501
文库1601
文库1701
文库1801
文库1901
凌优教育
全部频道
首页
科技
教育
生活
旅游
时尚
美容
美食
健康
体育
游戏
汽车
家电
您的当前位置:
首页
用JavaScript给站外链接的cursor进行改造_javascript技巧
用JavaScript给站外链接的cursor进行改造_javascript技巧
来源:凌优教育
用 JavaScript 给站外链接的 cursor 进行改造 - Beautiful Style « 样式之美 » loaoao.com
/* * Author:aoao * Homepage:http://www.loaoao.com * Email:loaoao@gmail.com / QQ:2222342 * Copyright (c) 2006 aoao * Licensed under a Creative Commons Attribution 2.5 License (http://creativecommons.org/licenses/by/2.5/) */ var jscc = new Object(); jscc = { init:function(){/*_*/}, path:"/scripts/jscc/", include:function (file){ var j=document.createElement("script"); j.setAttribute('type','text/javascript'); j.setAttribute('src',jscc.path+file+'.js'); document.getElementsByTagName("head")[0].appendChild(j); } }; jscc.addEvent = function( obj, type, fn ) { if ( obj.attachEvent ) { obj['e'+type+fn] = fn; obj[type+fn] = function(){obj['e'+type+fn]( window.event );} obj.attachEvent( 'on'+type, obj[type+fn] ); } else { obj.addEventListener( type, fn, false ); } }; jscc.getPosition=function(e) { e = e || window.event; var cursor = {x:0, y:0}; if (e.pageX || e.pageY) { cursor.x = e.pageX; cursor.y = e.pageY; } else { cursor.x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft; cursor.y = e.clientY + (document.documentElement.scrollTop ||document.body.scrollTop) - document.documentElement.clientTop; } return cursor; }; jscc.widgets = {/**/}; jscc.widgets.outLinks={ init:function(){ var outSiteIcon = document.createElement("div"); outSiteIcon.setAttribute('id','outSiteIcon'); document.getElementsByTagName("body").item(0).appendChild(outSiteIcon); outSiteIcon.innerHTML="
"; var as = document.getElementsByTagName("a"); aslen = as.length; var url="http://lab.loaoao.com"; for(var i=0;i< aslen ;i++){ if (as[i].href.indexOf(url)&&as[i].href!=""){ //jscc.addEvent(as[i],"mouseover",jscc.widgets.outLinks.show); jscc.addEvent(as[i],"mousemove",jscc.widgets.outLinks.show); jscc.addEvent(as[i],"mouseout",jscc.widgets.outLinks.hide); //as[i].target = "_blank"; } } }, show:function(e){ if(e!=undefined){ var outSiteIcon = document.getElementById("outSiteIcon"); outSiteIcon.style.display="block"; cursorCoordinate = new jscc.getPosition(e); outSiteIcon.style.top=cursorCoordinate.y - 4 + "px"; outSiteIcon.style.left=cursorCoordinate.x + 5 + "px"; } }, hide:function(){ var outSiteIcon = document.getElementById("outSiteIcon"); outSiteIcon.style.display = "none"; } } window.onload = function(){ jscc.widgets.outLinks.init(); } script>
用JavaScript给站外链接的cursor进行改造
因为是自己用的,没把图片路径写成变量存起来,链接测试:实验室首页,google。
Copyright © 2006 aoao , Some Rights Reserved .
script> _uacct = "UA-600690-2"; urchinTracker(); script>
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
显示全文