Friday 10 February 2012

PC --> 4 gReaT jAvAsCriPt tRickS


4 Great Javascript Tricks ~~>


First of all question arises what is Javascript? According to wikipedia :
JavaScript, also known as ECMAScript is a prototype-based object-oriented scripting language that is dynamic, weakly typed and has first-class functions. It is also considered a functional programming language like Scheme and OCaml because it has closures and supports higher-order functions. JavaScript is an implementation of the ECMAScript language standard and is primarily used in the form of client-side JavaScript, implemented as part of a web browser in order to provide enhanced user interfaces and dynamic websites. This enables programmatic access to computational objects within a host environment.
javascript tricks
1. Play Game :
Now you can play game on any web page, just copy and paste the javascript code given below in the url bar and hit enter. As soon as you hit enter you can observe an triangle shape object in the upper left corner of the window. Navigate it with the help of W, A and D keys and fire using Spacebar.
javascript:var%20s%20=%20document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='http://erkie.github.com/asteroids.min.js';void(0);
2. Edit Web Page :
You easily edit any web page using this javascript. But when you refresh the page changes are lost.
javascript: document.body.contentEditable = 'true'; document.designMode = 'on'; void 0
3. Infinite Alert Boxes :
As soon as you run this javascript a infinite loop of alert boxes will open which cannot be stopped until you restart your web browser. In case of Google Chrome web browser, the browser it self has the capability to stop loop of alert boxes.
javascript:while(1){alert('Restart your brower to close this box!')}
4. Calculator :
You can also use javascript for calculation purposes. Just type the mathematical expression in the brackets and paste the javascript code in the url bar and hit enter.
javascript: alert(4+5+6+7+(3*10));

3 comments: