教学项目二十四 Javascript中光标特效网页设计 基本内容】 讲解 JavaScript中几种光标特效网页设计 教学要求】 学会设计光标特效网页 案例设计 设计网页,实现图片跟随光标特效
教学项目二十四 JavaScript中光标特效网页设计 【基本内容】 讲解JavaScript中几种光标特效网页设计 【教学要求】 学会设计光标特效网页 一、案例设计 设计网页,实现图片跟随光标特效
a G: \FrontPage\javaSsanp5ht=- microsoft Internet Explorer 回回 文件 编辑)查看①收藏〔)工具〔)帮助Q ⊙后退·③·图的搜索次收夹的媒体的,·□ 习转到链接 完毕 3我的电脑 画2Ma.5nt4h
<html> <body> <script language="JavaScript"> var newtop=0; var newleft=0: if(navigator, appVersion indexOf("MSIE")! =-1)t layerStyle Ref="layer style. i layer Ref=document. all style Switch="style": function doMouseMoveo I layerName =iit eval(var curElement=+layerRef+'[+layerName+'"]')
<html> <body> <script language="JavaScript"> var newtop=0; var newleft=0; if (navigator.appVersion.indexOf("MSIE") != -1) { layerStyleRef="layer.style."; layerRef="document.all"; styleSwitch=".style"; } function doMouseMove() { layerName = 'iit' eval('var curElement='+layerRef+'["'+layerName+'"]')
eval(layerRef+["+layerName+]+styleSwitch+ visibility="hidden eval(curElement'+styleSwitch+ visibility="visible") eval(newleft=document. body. clientwidth curElement'+styleSwitch+. pixelWidth") eval(newtop=document. body. clientHeight- curElement'+styleSwitch+ pixelHeight) eval(height=curElement'+styleSwitch+ height) eval(width=curElement'+style Switch+ width) width=parseInt(width) height=parseInt(height) if (event. clientx >(document body. clientWidth-5-width)) newleft=document. body. clientWidth document body. scrollLeft width:
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden "') eval('curElement'+styleSwitch+'.visibility="visible"') eval('newleft=document.body.clientWidthcurElement'+styleSwitch+'.pixelWidth') eval('newtop=document.body.clientHeightcurElement'+styleSwitch+'.pixelHeight') eval('height=curElement'+styleSwitch+'.height') eval('width=curElement'+styleSwitch+'.width') width=parseInt(width) height=parseInt(height) if (event.clientX > (document.body.clientWidth - 5 - width)) { newleft=document.body.clientWidth + document.body.scrollLeft - 5 – width; }
else newleft=document. body. scrollLeft + event. client; evalCcurElement'+style Switch+. pixelLeft=newleft); if (event. client >(document body. clientHeight -5-height)) newtop=document. body. clientHeight document body.scrolL Top-5 height; else newtop=document. body. scrollTop event client eval( curElement'+styleSwitch+'. pixelTop=newtop')
else { newleft=document.body.scrollLeft + event.clientX; } eval('curElement'+styleSwitch+'.pixelLeft=newleft'); if (event.clientY > (document.body.clientHeight - 5 - height)) { newtop=document.body.clientHeight + document.body.scrollTop - 5 – height; } else { newtop=document.body.scrollTop + event.clientY; } eval('curElement'+styleSwitch+'.pixelTop=newtop'); }