Home > Web Front-end > JS Tutorial > body text

Several Interesting Javascript Hack_javascript Tips

WBOY
Release: 2016-05-16 18:22:30
Original
1066 people have browsed it
1. Edit web page content directly in the browser
Copy the code The code is as follows:
javascript:document.body.contentEditable='true';document.designMode='on'; void(0);
Visit any website and enter the above code in the address bar. It will happen that the current webpage has changed to edit mode. .

2. Dancing pictures
Copy code The code is as follows:
javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; =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) "px"; DIS.top=(Math.cos(R*y1 i*y2 y3)*y4 y5) "px"} R }setInterval('A()',5); void(0);


3. Swinging around (not allowed for testing here)
Not only you, but browsers don’t like this javascript that much either. After running this code in the address bar, the browser wobbles around rapidly. The code is as follows:
Copy code The code is as follows:

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

If this code is invalid, please change ">" to ">" and "&It;' to "<".
4. Calculator
Enter in the address bar The following code can implement simple four arithmetic operations:
Copy code The code is as follows:

javascript : alert(34343 3434-222);

In fact, this code can continue to be simplified, for example, simplified to this:
javascript: 34343 3434-222
5. Anti-phishing Verification
The URL provided by some phishing websites is inconsistent with the URL of the web page itself. You can use the following code to verify. When the two URLs are too different, you have to be careful:
javascript:alert("The actual URL is:tt" location.protocol "//" location.hostname "/" "nThe address URL is:tt" location.href "n" "nIf the server names do not match , this may be a spoof.");
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!