JavaScript special effects Source (4, mouse effects)

Source: Internet
Author: User
Tags cos sin

1, mouse induction--Fade effect

2, mouse Induction--pop-up warning box

Mouse Induction-pop-up warning box [modify the text] [total 1 steps] [This effect is not much use, but in the individual places can also add a lot of color! ^-^]====1, add the following code to the HTML <body></body>: <a href onmouseover= "alert (' ^-^ haha fooled, in fact, nothing! > Want to hear a joke? </a>   

 3, follow the mouse's * effects

  *[recommendations with mouse [total 2 steps] [no modification] [by the way, it doesn't have to be. * Use your imagination instead! But it seems to be more beautiful! ]====1, add the following code to HEML 

 4, text effects that follow the mouse

  Follow the mouse text [modify the displayed text and color code can] [a total of 1 steps]====1, add the following code to the HTML <body></body> <style type= "Text/css"; Spanstyle {position:absolute;visibility:visible;top:-50px;font-size:9pt;color: #000000; font-weight:bold;} </style><script>var x,yvar Step=20var Flag=0var message= "javascript source code Daquan. "Message=message.split (") var xpos=new array () for (i=0;i<=message.length-1;i++) {Xpos[i]=-50}var ypos=new array () for (i=0;i<=message.length-1;i++) {ypos[i]=-50}function HANDLERMM (e) {x = (document.layers)? E.pagex: Document.body.scrollleft+event.clientxy = (document.layers)? E.pagey:document.body.scrolltop+event.clientyflag=1}function Makesnake () {if (flag==1 && document.all) {for ( I=message.length-1; i>=1; i--) {xpos[i]=xpos[i-1]+stepypos[i]=ypos[i-1]}xpos[0]=x+stepypos[0]=yfor (i=0; i<message.length-1; i++) {var Thisspan = eval ("span" + (i) + ". Style") Thisspan.posleft=xpos[i]thisspan.postop=ypos[i]}}else if (Flag==1 && Document.layers) {for (i=message.length-1; I&GT;=1; i--) {xpos[i]=xpos[i-1]+stepypos[i]=ypos[i-1]}xpos[0]=x+stepypos[0]=yfor (i=0; i<message.length-1; i++) {var Thisspan = eval ("Document.span" +i) thisspan.left=xpos[i]thisspan.top=ypos[i]}}var timer=settimeout ("Makesnake ()", }</script><body onload= "Makesnake ()" ><script>for (i=0;i<=message.length-1;i++) { document.write ("<span id= ' span" +i+ "' class= ' Spanstyle ' >") document.write (Message[i]) document.write ("</ Span> ")}if (document.layers) {document.captureevents (event.mousemove);}   Document.onmousemove = handlermm;</script>

 5, following the mouse picture

Follow the mouse picture [modify the image name and path a total of 2 steps]====1, add the following code to HEML 

 6, fireflies following the mouse

Follow the mouse firefly [without modification] [] A total of 1 steps]====1, add the following code between the Heml <body></body>: <script language= "JavaScript" >if (! Document.layers&&!document.all) event= "test" function showtip2 (current,e,text) {if (document.all&& document.readystate== "complete") {document.all.tooltip2.innerhtml= ' <marquee style= ' border:1px solid black ' > ' +text+ ' </marquee> ' document.all.tooltip2.style.pixelleft=event.clientx+document.body.scrollleft+ 10document.all.tooltip2.style.pixeltop=event.clienty+document.body.scrolltop+ 10document.all.tooltip2.style.visibility= "Visible"}else if (document.layers) { Document.tooltip2.document.nstip.document.write (' <b> ' +text+ ' </b> ') Document.tooltip2.document.nstip.document.close () document.tooltip2.document.nstip.left=0currentscroll= SetInterval ("Scrolltip ()", +) document.tooltip2.left=e.pagex+10document.tooltip2.top=e.pagey+ 10document.tooltip2.visibility= "Show"}}function hidetip2 () {if (document.all) document.all.tooltip2.style.visibility= "hidden" else if (document.Layers) {clearinterval (currentscroll) document.tooltip2.visibility= "hidden"}}function scrolltip () {if ( Document.tooltip2.document.nstip.left>=-document.tooltip2.document.nstip.document.width) document.tooltip2.document.nstip.left-=5elsedocument.tooltip2.document.nstip.left=150}</script>< Script language= "JavaScript" >function Yy_layerfx (yyleft,yytop,yyfnx,yyfny,yydiv,yybilder,yyloop,yyto,yycnt, Yystep) {//v1.2if (document.layers) | | (document.all)) {with (math) {yynextx= eval (yyfnx)}with (math) {yynexty= eval (yyfny)}yycnt= (Yyloop && yycnt>=yystep* Yybilder)? 0:yycnt+yystep;if (document.layers) {eval (yydiv+ ". top=" + (Yynexty+yytop)) eval (yydiv+ ". left=" + (yynextx+ Yyleft))}if (document.all) {eval ("Yydiv=yydiv.replace (/.layers/gi, '. All ')"), Eval (yydiv+ ". style.pixeltop=" + ( yynexty+yytop)); eval (yydiv+ ". style.pixelleft=" + (Yynextx+yyleft)); }argstr= ' Yy_layerfx (' +yyleft+ ', ' +yytop+ ', "' +yyfnx+ '", "' +yyfny+ '", "' +yydiv+ '", ' +yybilder+ ', ' +yyloop+ ', ' +yyto+ ', ' +yycnt+ ', ' +yystep+ ') '; if (yycnt< =yystep*yybilder) {eval (yydiv+ ". Yyto=settimeout (Argstr,yyto)");}}} function Yy_mousetrace (evnt) {if (YYNS4) {if (Evnt.pagex) {yy_ml=evnt.pagex; yy_mt=evnt.pagey;}} Else{yy_ml= (Event.clientx + document.body.scrollLeft); yy_mt= (Event.clienty + document.body.scrollTop);} if (yy_tracescript) eval (yy_tracescript)}</script><script language= "JavaScript" >function PopWin () {var Popwin = window.open ("new.htm", "Popwin", "toolbar=no,directries=no,scrollbars=yes,height=350,width=400");} </script><body><div id= "tooltip2" style= "position:absolute;visibility:hidden;clip:rect (0 150 50 0); Width:150px;background-color:lightyellow "><layer name=" Nstip "width=" 1000px "bgcolor=" Lightyellow "></ Layer></div><div id= "yyd0" style= "Position:absolute; left:10px; top:50px; width:3px; height:3px; Z-index:1; Background-color: #19636c; Layer-background-color: #19636c; border:1px none #000000; Clip:rect (0 3 3 0) "></div><divid=" Yyd1 "style=" Position:absolute; Left20px; top:50px; width:3px; height:3px; Z-index:1; Background-color: #708574; Layer-background-color: #708574; border:1px none #000000; Clip:rect (0 3 3 0) "></div><divid=" Yyd2 "style=" Position:absolute; left:30px; top:50px; width:3px; height:3px; Z-index:1; Background-color: #379bbf; Layer-background-color: #379bbf; border:1px none #000000; Clip:rect (0 3 3 0) "></div><divid=" Yyd3 "style=" Position:absolute; left:40px; top:50px; width:3px; height:3px; Z-index:1; Background-color: #25184c; Layer-background-color: #25184c; border:1px none #000000; Clip:rect (0 3 3 0) "></div><divid=" Yyd4 "style=" Position:absolute; left:50px; top:50px; width:3px; height:3px; Z-index:1; Background-color: #31bd3c; Layer-background-color: #31bd3c; border:1px none #000000; Clip:rect (0 3 3 0) "></div><divid=" Yyd5 "style=" Position:absolute; left:60px; top:50px; width:3px; height:3px; Z-index:1; Background-color: #c11efd; Layer-background-color: #c11efd; BORDER:1PX NoNE #000000; Clip:rect (0 3 3 0) "></div><script>var Yyns4=window. Event?true:false; var yy_mt = 0; var yy_ml = 0;document.onmousemove = Yy_mousetrace;yy_tracescript = ";" if (YYNS4) {document.captureevents ( Event.mousemove); Yy_mousetrace (', ', document. Yy_mousetrace1 ')}yy_layerfx (0,0, ' Yy_ml+cos ((15*sin (yycnt/39.83007847812662)) +0) *150* (sin (10+yycnt/20) +0.2) *cos (YYCNT/20) ', ' Yy_mt+sin ((15*sin (yycnt/34.224861639800686)) +0) *150* (sin (10+yycnt/20) +0.2) *cos (YYCNT/20) ', ' Document.layers[\ ' yyd0\ ', 2000,true,80,0,1); Yy_layerfx (0,0, ' Yy_ml+cos ((15*sin (yycnt/27.66510707209673)) +30) *150* (sin (10+yycnt/20) +0.2) *cos (YYCNT/20) ', ' Yy_ Mt+sin ((15*sin (yycnt/9.240632767417667)) +30) *150* (sin (10+yycnt/20) +0.2) *cos (YYCNT/20) ', ' document.layers[\ ' yyd1 \ '] ', 2000,true,80,0,1); Yy_layerfx (0,0, ' Yy_ml+cos ((15*sin (yycnt/16.45318944579641)) +60) *150* (sin (10+yycnt/20) +0.2) *cos (YYCNT/20) ', ' Yy_ Mt+sin ((15*sin (yycnt/16.0564452288292)) +60) *150* (sin (10+yycnt/20) +0.2) *cos (YYCNT/20) ', ' document.layers[\ ' yyd2\ '] ', 2000,true,80,0,1); Yy_layerfx (0,0, ' Yy_ml+cos ((15*sin (yycnt/6.95348954836835)) +90) *150* (sin (10+yycnt/20) +0.2) *cos (YYCNT/20) ', ' Yy_ Mt+sin ((15*sin (yycnt/44.13697049887155)) +90) *150* (sin (10+yycnt/20) +0.2) *cos (YYCNT/20) ', ' document.layers[\ ' yyd3 \ '] ', 2000,true,80,0,1); Yy_layerfx (0,0, ' Yy_ml+cos ((15*sin (yycnt/33.90077294583733)) +120) *150* (sin (10+yycnt/20) +0.2) *cos (YYCNT/20) ', ' yy _mt+sin ((15*sin (yycnt/2.2378828869411587)) +120) *150* (sin (10+yycnt/20) +0.2) *cos (YYCNT/20) ', ' document.layers[\ ' Yyd4\ '] ', 2000,true,80,0,1); Yy_layerfx (0,0, ' Yy_ml+cos ((15*sin (yycnt/37.858312521039835)) +150) *150* (sin (10+yycnt/20) +0.2) *cos (YYCNT/20) ', ' Yy_mt+sin ((15*sin (yycnt/18.083839795990098)) +150) *150* (sin (10+yycnt/20) +0.2) *cos (YYCNT/20) ', ' document.layers[\  ' Yyd5\ ', 2000,true,80,0,1);</script></body>

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.