Cool JavaScript Tricks

Published On July 7, 2008
123 Comments Leave a Comment

Today, I will list some very cool JavaScript hacks and tricks that you can use creatively or just have plain fun. To make each one of these codes work, all you have to do is copy and paste it into the address bar of your browser window and hit “Enter”. So here they are :-

Play the “Lord of the Web”

This code lets you edit any page/website in real-time πŸ™‚ . With Firefox, you can even edit and save the modified pages to your computer. Very nifty code!

javascript:document.body.contentEditable='true'; document.designMode='on'; void 0

The Big Wheel

This piece of code pulls off all the images from your web page and rotates them in a circle. Really makes any page go naked (without its images). The best place to test is a website with many images. (Google Images for an example)

javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; 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++}setInterval('A()',5); void(0);

If you look carefully in the above code, its rotating the HTML “img” tag. Just replace it with “a” or “p” and watch some links or text rotate instead of images.

Tremors

Your browser will be very afraid of this code πŸ™‚ If the code below doesn’t seem to work, please replace > with > and < with <javascript:function flood(n) {if (self.moveBy) {for (i = 200; i > 0;i–){for (j = n; j > 0; j–) {self.moveBy(1,i); self.moveBy(i,0);self.moveBy(0,-i); self.moveBy(-i,0); } } }}flood(6);{ var inp = “D-X !msagro na dah tsuj resworb rouY”; var outp = “”; for (i = 0; i <= inp.length; i++) {outp =inp.charAt (i) + outp ; } alert(outp) ;}; reverse

The Calculator

In case you are not in a mood to use the standard windows calculator and want your browser to do the dirty job for you, use this code.

javascript: alert(34343+3434-222);

You can change the numbers according to your choice and also try creative complex equations. Just put your arithmetic into javascript: alert( );

Finding Spoof Websites

There are times when you are not sure that the website that you are visiting is authentic. Use this code whenever in doubt :-

javascript:alert("The actual URL is:\t\t" + location.protocol + "//" + location.hostname + "/" + "\nThe address URL is:\t\t" + location.href + "\n" + "\nIf the server names do not match, this may be a spoof.");

And finally here is something that you can only get to hear if you ever worked in a Tech Support department πŸ™

123 replies on “Cool JavaScript Tricks”

Pretty nice post. I simply stumbled upon your weblog and wished to
mention that I have truly enjoyed browsing your blog posts.
In any case I will be subscribing in your rss
feed and I hope you write again very soon!

Write more, thats all I have to say. Literally, it seems as though you relied
on the video to make your point. You definitely know what youre talking about,
why waste your intelligence on just posting videos to your weblog when you could be giving us something informative to read?

Hi there! This article couldn’t be written much better! Looking at this post reminds me of my previous roommate! He always kept talking about this. I most certainly will send this post to him. Fairly certain he will have a very good read. I appreciate you for sharing!

Step 1: Go to high-quality store report and ne’er of all time buy card antics that contain controversial contents such as political and off-the-course humors. But this trick will motives is 16 card games from a steady acting deck of cards. The secret Focus is authoritative. Of class, if you execute these have hit specialized knowledge in the field of honor of medicinal drug. Cellulite is nothing but fat cadres existing trapped of facial facial expressions so that the audience pores on your look and cuts your fleet, sneaky hired hand social movements.

Throughout this grand pattern of things you receive a B+ just for hard work. Where exactly you misplaced me was first on the particulars. You know, as the maxim goes, details make or break the argument.. And that could not be much more correct at this point. Having said that, allow me tell you exactly what did do the job. Your writing is highly persuasive which is possibly the reason why I am taking an effort in order to opine. I do not really make it a regular habit of doing that. Secondly, although I can certainly notice the jumps in reasoning you come up with, I am not really sure of just how you appear to connect the details which in turn make the actual conclusion. For the moment I will subscribe to your issue however hope in the future you actually link the facts much better.

ferozshaikh Reply

Thank you again for all the knowledge you distribute,Good post. I was very interested in the article, it’s quite inspiring I should admit. I like visiting you site since I always come across interesting articles like this one.Great Job, I greatly appreciate that.Do Keep sharing!

ferozshaikh Reply

I’m glad I found this web site, I couldn’t find any knowledge on this matter prior to.Also operate a site and if you are ever interested in doing some visitor writing for me if possible feel free to let me know, i am always look for people to check out my website.

ferozshaikh Reply

Awesome article! I want people to know just how good this information is in your article. It’s interesting, compelling content. Your views are much like my own concerning this subject.

I found my browser removed the javascript: at the beginning when I copy/pasted. Adding it to the beginning after I pasted worked. Or if it changes to http:// at the beginning replace it with javascript:

hey i got a problem all of the codes dont work on my computer i use firefox and chrome but none of these cods work please help me because i dont know how to use this and it sounds fun πŸ™ please reply

Its because when u copy the javascript line it will not copy the first part of the line that says “javascript:” you have to type it in by urself and then copy the code.

Dude! These are amazing! My friend put them on google images (big wheel) and it was friggin hilarious! Could someone tell me how to apply Big Wheel to a website? Thanks!

The evil one Reply

Nice codes! Only thing is i can’t seem to get the tremors to work on IE, Firefox or chrome. Anyone got any ideas?

very nice if you really want to build a exciting web page add some rotating script and some moving pictures (.gif) type but build them with java best of luck and have some fun. There are many of ways to make your website better

dude hw did u use the tremors one please can u help me out with it i use internet explorer 8 but the javascript doesn’t work plzz zhelp

Anonymous Reply

None of them worked, errors:

(1) Expected Objects
(2) Did not close parenthesis
(3) Did not define “document”

These errors were found when saved from Notepad as the .js format, maybe I did that wrong? Hopefully you can fix that!

Thanks!

Dexter Reply

I can note something interesting with Google Notebook by selecting the text and just clicking a bookmark “javascript:(function(){var w=window;var d=document;var g=w.open(‘about:blank’,’gnotesWin’,’location=0,menubar=0,scrollbars=0,s”. However, Google Notebook limits the number of words in a single Note. I wonder if it’s possible to note text with Google Doc by clicking just a bookmark containing a set of javascript code?

Very funny post. The tech guy image reminds me of our workplaces and when customers call up talking nonsense!

The Finding Spoof Websites code sounds interesting so I will have to check that one out.

This passage is really cool and I translate it into Chinese and posted it in my website SPEWARE.cn . Thanks a million!! If you don’t like it, I will delete my translation.
From the Trackback I guess your blog is hot in China. I think you can revise your plugin to let it support Chinese. My English is not very good. Thanks again!

Very interesting post – I don’t know that I want to make my browser very afraid, but I laughed and laughed at your comic at the end! Have a good day!
Beth

I often find something cool like this and think “Interesting, but I don’t think I could use this anywhere.” … well, I’m still thinking that here, BUT I have a feeling I actually will put one of those into something.

I don’t get your instructions under Tremors. Replace what?

Leave a Reply to mana Cancel reply

Your email address will not be published. Required fields are marked *