Last Update:2017-08-24
Source: Internet
Author: User
Keywords
Web page production
Ajax
javascript
Web Effects Tips Tutorial Tip effect Code
<!doctype HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.jzread.com/tr/xhtml1/dtd/ Xhtml1-transitional.dtd "> <html> <head> <title> Web page Special tips Tip effect Code </title> <style type= "text/css Tutorial" > *{margin:0 padding:0} #a {width:300px; height:300px display:none; background: #cf0; Position:absolute;z-index:2} #c div{position:absolute;background: #c00; width:50px; height:50px;} #c div.d1{left:1000px;top:50px} #c div.d2{left:800px;top:500px} #c div.d3{left:10px;top:30px} #c div.d4{left:50px;top:650px} #c div.d5{left:500px;top:50px} #c div.d6{left:300px;top:300px} #c div.d7{left:1100px;top:700px} #c div.d8{left:300px;top:600px} </style> </head> <body> <div id= "a" >www.jzread.com</div> <div id= "C" > <div class= "D1" >www.jzread.com</div> <div class= "D2" >www.jzread.com</div> <div class= "D3" >www.jzread.com</div> <div class= "D4" >www.jzread.com</div> <div class= "d5" >www.jzread.com</div> <div class= "d6" >www.jzread.com</div> <div class= "D7" >www.jzread.com</div> <div class= "D8" >www.jzread.com</div> </div> </body> <script type= "Text/javascript" > function GetStyle (obj,name) { return Obj.currentstyle?obj.currentstyle[name]:(document.defaultview.getcomputedstyle (obj, ""). GetPropertyValue (name) } For (Var I=0;i<document.getelementbyid ("C"). getElementsByTagName ("div"). length;i++) { document.getElementById ("C"). getElementsByTagName ("div") [I].onmouseo tutorial Ver=function () { var O=document.getelementbyid ("a"); var S=document.getelementbyid ("C"); if (!o.style.left) o.style.left=0; if (!o.style.top) o.style.top=0; var ow = GetStyle (o, "width"); var oh = GetStyle (o, "height"); var sl = GetStyle (this, left); var st = GetStyle (this, top); var sw = GetStyle (This, "width"); var sh = getstyle (this, "height"); ow = parseint (OW); Oh = parseint (OH); SL = parseint (SL); st = parseint (ST); SW = parseint (SW); sh = parseint (SH); var x= (x<=ow+sw+10)? 360:document.documentelement.clientwidth; var y= (y<=oh+sh+10)? 360:document.documentelement.clientheight; if (x < OW+SW) { o.style.left = sl+sw+10 + "px" }else{ o.style.left = (x-sl-10 > ow)? (sl+sw+10 + "px"):(sl-ow-10 + "px"); } if (Y < OW+SW) { o.style.top = st+10 + "px" }else{ o.style.top = (y-st-10 > Oh)? (st+10 + "px"):(St-oh-10+sh + "px"); } o.style.display= "Block"; } document.getElementById ("C"). getElementsByTagName ("div") [I].onmouseout=function (e) { var O=document.getelementbyid ("a"); o.style.display= "None"; } } </script> </html>