9 Funniest JavaScript Effects

Everybody knows the Internet is the environment that we can use for a lot of things. The Internet is getting more and more important, we can use it for working, learning, for entertaining …

Only in the aspect of entertainment, we use the Internet to play online games, to search, listen & download the favorite songs, videos, movies, …

The Internet also is the very good environment for studying, it helps us in looking for the materials, solving our problems, getting the supports from the other persons, … Especially in the field of computers in general, web programming in particular; many people think the programming languages are only for working, there’s no joy in it.

That’s reason why I wrote this post, I just want to say to all: with JavaScript, you can find some little joys; JavaScript can make many funny things that you may not have realized. Here’s list of funniest things JavaScript can do.

Advertisement

1. Pictures flying as a snake around the mouse pointer

Just paste the JavaScript below into the address bar of any browser then press Enter, it makes all pictures on the current web page fly around like a snake when you move the pointer.javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; var DI= document.getElementsByTagName("img"); DIL=DI.length; function A(){for(i=0; i<DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5+"px"; DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5+"px"}R++}tag=setInterval('A()',5 );document.onmousedown=function(){clearInterval(tag);for(i=0; i<DIL; i++){DI[i].style.position="static";}}; void(0) In the above JavaScript, you can change document.getElementsByTagName("img") to any HTML tag that you want to apply.

2. Transform the web page into the eaditable mode

javascript:document.body.contentEditable='true'; document.designMode='on'; void 0 This JavaScript code lets you modify any web page in real-time; and with Firefox, you can even save the modified web pages to your computer. You can do many funny things with the simple JavaScript above, such as: faking the screen capture of some proof, faking some hot news for April Fool’s Day… quickly.

Conclusion

Some JavaScript codes can be executed in the address bar of browser immediately, others must be used as a HTML file for affecting. But I hope you’ll like this post and find some funny things; if you know anymore, please let me know.

References

Phong Thai is a Web Developer, Web Coder for 9+ years with PHP, JavaScript, CSS. He is the creator of JavaScriptBank.com & 9BlogTips.com – provide thousands of free JavaScript code examples, web development tips and tricks, helpful blogging guides. Follow him on twitter@js_bank or connect with him on facebook@jsbank if you want.