The Internet is becoming more and more important. We can use it for work, study, and entertainment. In terms of entertainment, we play games, search, listen to, and download our favorite songs, videos, and movies on the Internet. The Internet is also a very good learning environment. It is helpful for us to find information and help us solve the problems we encounter. It is also widely used in the computer field, in particular, in program development, many people think that programming languages are only used for work and there is no pleasure. In fact, as long as we make full use of our whimsy, there is also an interesting aspect of rigid things. The purpose of this article is to tell everyone that using JavaScript can do a lot of interesting things.
1. Let the pictures on the webpage fly
After you paste the following code into the address bar of the browser and press Enter, all the images on the current webpage will be moved.
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 JavaScript above, you can modify document. getElementsByTagName ("img") to any HTML tag you want to apply.
This is another version:
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.images;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;DIS.top=Math.cos(R*y1+ i*y2+y3)* y4+y5;} R++;}setInterval('A()',5);void(0);
2. Convert the webpage to the editing mode
The image is for demonstration only. You can paste the following code to the address bar to see the actual effect.
javascript:document.body.contentEditable='true'; document.designMode='on'; void(0);
This JavaScript code allows you to modify any webpage in real time. In Firefox, you can even save the modified webpage. With the simple JavaScript code above, you can do a lot of interesting things. For web designers, this function can help improve the page effect.
3. You must love me
Send the link of this example to your beloved person and ask her to answer "Do you love me ?", She can't answer No in any way, haha ~
Demo source code
4. error message prompt box
This is a joke similar to the one above, but here we use images for selection. This interesting idea, coupled with some different pictures, can create more interesting applications.
5. Cheerleading animations made of Text
I don't need to talk about anything more. Please try it yourself, haha.
Demo source code
6. deceptive text input box
This script proves that you trust others too much. Don't believe me? Try it if you don't believe it.
Demo source code
7. closed window
It may not be so interesting to think carefully before running this script. Make sure that a new window is displayed.
Demo source code
8. Shake the browser window
Changing the size of the browser window to the normal mode may have the best half screen effect. Paste the following code to the address bar and press Enter. (I tried it several times and I saw the legendary effect. I wonder if you can try it out)
javascript:function Shw(n) {if (self.moveBy) {for (i = 35; 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); }}}} Shw(6);
9. Love test
A small script used to test the love index between two people is just a joke. The consequences are at your own risk. Haha ~ Only English names are supported.
Demo source code
Simple and interesting games developed with JavaScript
At the end of this article, I will list some game resources developed using javascript. I hope you can find some interesting things.
-Game Scripts
-25 Amazing JavaScript Games
-JavaScript Gaming
-Free JavaScript Games Download
-Free JavaScript Games
Link to this article: 9 very interesting javascript applications
9. Funniest JavaScript Effects