资料
表格
制度
合同
管理
职场
经营
创业
范文
总结
计划
作文
文章
美文
词句
教程
模板
图片
字体
图标
办公
人事
财务
生产
管理资源吧首页
>>>
教程
>>>
编程
>>>
JavaScript教程
>>>
用 JavaScript 给站外链接的 cursor 进行改造
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>用 JavaScript 给站外链接的 cursor 进行改造 - Beautiful Style « 样式之美 » loaoao.com </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="KEYWords" content="js,cursor,outlinks,links,jscc,css,xhtml,effect" /> <meta name="DEscription" content="用 JavaScript 给站外链接的 cursor 进行改造" /> <meta name="author" content="aoao" /> <meta content="all" name="robots" /> <link rel="start" href="http://www.loaoao.com" title="Home" /> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%20type%3D%22text%2Fjavascript%22%3E%20%0D%0A%2F*%20%20%20%0D%0A%20*%20%20Author%3Aaoao%20%0D%0A%20*%20%20%20%20Homepage%3Ahttp%3A%2F%2Fwww.loaoao.com%20%0D%0A%20*%20%20Email%3Aloaoao%40gmail.com%20%2F%20QQ%3A2222342%20%0D%0A%20*%20%20Copyright%20(c)%202006%20aoao%20%0D%0A%20*%20%20Licensed%20under%20a%20Creative%20Commons%20Attribution%202.5%20License%20(http%3A%2F%2Fcreativecommons.org%2Flicenses%2Fby%2F2.5%2F)%20%20%0D%0A%20*%2F%20%0D%0A%0D%0Avar%20jscc%20%3D%20new%20Object()%3B%20%0D%0Ajscc%20%3D%20%7B%20%20%20%20%20%0D%0A%20%20%20%20init%3Afunction()%7B%2F*_*%2F%7D%2C%20%0D%0A%20%20%20%20path%3A%22%2Fscripts%2Fjscc%2F%22%2C%20%0D%0A%20%20%20%20include%3Afunction%20(file)%7B%20%0D%0A%20%20%20%20%20%20%20%20var%20j%3Ddocument.createElement(%22script%22)%3B%20%0D%0A%20%20%20%20%20%20%20%20j.setAttribute('type'%2C'text%2Fjavascript')%3B%20%0D%0A%20%20%20%20%20%20%20%20j.setAttribute('src'%2Cjscc.path%2Bfile%2B'.js')%3B%20%0D%0A%20%20%20%20%20%20%20%20document.getElementsByTagName(%22head%22)%5B0%5D.appendChild(j)%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%7D%3B%20%0D%0Ajscc.addEvent%20%3D%20function(%20obj%2C%20type%2C%20fn%20)%20%7B%20%0D%0A%20%20%20%20if%20(%20obj.attachEvent%20)%20%7B%20%20%20%20%20%20%20%20%20%0D%0A%20%20%20%20%20%20obj%5B'e'%2Btype%2Bfn%5D%20%3D%20fn%3B%20%0D%0A%20%20%20%20%20%20obj%5Btype%2Bfn%5D%20%3D%20function()%7Bobj%5B'e'%2Btype%2Bfn%5D(%20window.event%20)%3B%7D%20%0D%0A%20%20%20%20%20%20obj.attachEvent(%20'on'%2Btype%2C%20obj%5Btype%2Bfn%5D%20)%3B%20%0D%0A%20%20%20%20%7D%20else%20%7B%20%0D%0A%20%20%20%20%20%20obj.addEventListener(%20type%2C%20fn%2C%20false%20)%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%7D%3B%20%0D%0A%0D%0Ajscc.getPosition%3Dfunction(e)%20%7B%20%0D%0A%20%20%20%20e%20%3D%20e%20%7C%7C%20window.event%3B%20%0D%0A%20%20%20%20var%20cursor%20%3D%20%7Bx%3A0%2C%20y%3A0%7D%3B%20%0D%0A%20%20%20%20if%20(e.pageX%20%7C%7C%20e.pageY)%20%7B%20%0D%0A%20%20%20%20%20%20%20%20cursor.x%20%3D%20e.pageX%3B%20%0D%0A%20%20%20%20%20%20%20%20cursor.y%20%3D%20e.pageY%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%20%20%20%20else%20%7B%20%0D%0A%20%20%20%20%20%20%20%20cursor.x%20%3D%20e.clientX%20%2B%20(document.documentElement.scrollLeft%20%7C%7C%20document.body.scrollLeft)%20-%20document.documentElement.clientLeft%3B%20%0D%0A%20%20%20%20%20%20%20%20cursor.y%20%3D%20e.clientY%20%2B%20(document.documentElement.scrollTop%20%7C%7Cdocument.body.scrollTop)%20-%20document.documentElement.clientTop%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%20%20%20%20return%20cursor%3B%20%0D%0A%7D%3B%20%0D%0Ajscc.widgets%20%3D%20%7B%2F**%2F%7D%3B%20%0D%0Ajscc.widgets.outLinks%3D%7B%20%0D%0A%20%20%20%20init%3Afunction()%7B%20%0D%0A%0D%0A%20%20%20%20%20%20%20%20var%20outSiteIcon%20%3D%20document.createElement(%22div%22)%3B%20%0D%0A%20%20%20%20%20%20%20%20outSiteIcon.setAttribute('id'%2C'outSiteIcon')%3B%20%0D%0A%20%20%20%20%20%20%20%20document.getElementsByTagName(%22body%22).item(0).appendChild(outSiteIcon)%3B%20%0D%0A%20%20%20%20%20%20%20%20outSiteIcon.innerHTML%3D%22%3Cimg%20src%3D%5C%22outlink.gif%5C%22%20%2F%3E%22%3B%20%0D%0A%20%20%20%20%20%20%20%20var%20as%20%3D%20document.getElementsByTagName(%22a%22)%3B%20%0D%0A%20%20%20%20%20%20%20%20aslen%20%3D%20as.length%3B%20%0D%0A%20%20%20%20%20%20%20%20var%20url%3D%22http%3A%2F%2Flab.loaoao.com%22%3B%20%0D%0A%20%20%20%20%20%20%20%20for(var%20i%3D0%3Bi%3C%20aslen%20%3Bi%2B%2B)%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(as%5Bi%5D.href.indexOf(url)%26%26as%5Bi%5D.href!%3D%22%22)%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2Fjscc.addEvent(as%5Bi%5D%2C%22mouseover%22%2Cjscc.widgets.outLinks.show)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20jscc.addEvent(as%5Bi%5D%2C%22mousemove%22%2Cjscc.widgets.outLinks.show)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20jscc.addEvent(as%5Bi%5D%2C%22mouseout%22%2Cjscc.widgets.outLinks.hide)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2Fas%5Bi%5D.target%20%3D%20%22_blank%22%3B%20%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%7D%2C%20%0D%0A%20%20%20%20show%3Afunction(e)%7B%20%0D%0A%20%20%20%20%20%20%20%20if(e!%3Dundefined)%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20var%20outSiteIcon%20%3D%20document.getElementById(%22outSiteIcon%22)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20outSiteIcon.style.display%3D%22block%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20cursorCoordinate%20%3D%20new%20jscc.getPosition(e)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20outSiteIcon.style.top%3DcursorCoordinate.y%20-%204%20%2B%20%22px%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20outSiteIcon.style.left%3DcursorCoordinate.x%20%2B%205%20%2B%20%22px%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%7D%2C%20%0D%0A%20%20%20%20hide%3Afunction()%7B%20%0D%0A%20%20%20%20%20%20%20%20var%20outSiteIcon%20%3D%20document.getElementById(%22outSiteIcon%22)%3B%20%0D%0A%20%20%20%20%20%20%20%20outSiteIcon.style.display%20%3D%20%22none%22%3B%20%0D%0A%20%20%20%20%7D%20%0D%0A%7D%20%0D%0A%0D%0Awindow.onload%20%3D%20function()%7B%20%0D%0Ajscc.widgets.outLinks.init()%3B%20%0D%0A%7D%20%0D%0A%3C%2Fscript%3E"> <style type="text/css"> #outSiteIcon{ position:absolute; z-index:99; display:none; } </style> </head> <body> <h1>用JavaScript给站外链接的cursor进行改造</h1> <p>因为是自己用的,没把图片路径写成变量存起来,链接测试:<a href="/" _ewebeditor_ta_href="%2F">实验室首页</a>,<a href="http://www.google.com" _ewebeditor_ta_href="http%3A%2F%2Fwww.google.com">google</a>。</p> <p>Copyright © 2006 <a href="http://www.loaoao.com/" _ewebeditor_ta_href="http%3A%2F%2Fwww.loaoao.com%2F">aoao</a> , <a href="http://www.creativecommons.cn/licenses/by-nc/2.5/" _ewebeditor_ta_href="http%3A%2F%2Fwww.creativecommons.cn%2Flicenses%2Fby-nc%2F2.5%2F" >Some Rights Reserved</a> .</p> <!--统计代码开始 --> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%20src%3D%22http%3A%2F%2Fwww.google-analytics.com%2Furchin.js%22%20type%3D%22text%2Fjavascript%22%3E%3C%2Fscript%3E"> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%20type%3D%22text%2Fjavascript%22%3E%20%0D%0A%20%20%20%20_uacct%20%3D%20%22UA-600690-2%22%3B%20%0D%0A%20%20%20%20urchinTracker()%3B%20%0D%0A%20%20%20%20%3C%2Fscript%3E"> <!--统计代码结束 --> </body> </html>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行
]
教程首页
更多教程