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.
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.
In the above JavaScript, you can change
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.
Here’s some another versions of this effect:
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. Transform the web page into the editable 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.3. You must love me
Give your lover the link of this effect, then ask her to answer the question “Do you love (marry) me?” and she can’t repudiate, lol.
Demo : Try it this is really nice...
Code:
<html>
<head>
<title>You must love me</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="copyright" content="http://www.javascriptbank.com" />
<script type="text/javascript"> flag=1 function f1() { alert("Yes. you are right ") } function f() { if(flag==1) { Bn.style.top=90 Bn.style.left=500 flag=2 } else if(flag==2) { Bn.style.top=90 Bn.style.left=50 flag=3 } else if(flag==3) { Bn.style.top=235 Bn.style.left=360 flag=1 } } </script>
</head>
<body>
<h1 style="position:absolute; left:220px; top:175px; width:auto; height:210px;">Do you love me?</h1>
<div id="By" style="position:absolute; left:285px; top:235px; width:210px; height:210px;">
<input type="button" value=" yes " onclick="f1undefined)" />
</div>
<div id="Bn" style="position:absolute; left:360px; top:235px; width:210px; height:210px;">
<input type="button" value=" no " onmouseover="fundefined)" />
</div>
</body>
</html>
4. Joking Error Message Alert box
Like the above funny JavaScript but this script uses the picture to make the choices; maybe from the idea of this joke plus some different pictures, you can make more funny jokes.
5. The text based Cheerleader Animation
No need to say more about it, let try it out by yourself.
Demo Link
Code:
<html>
<head>
<script language="JavaScript"> <!-- Web Site: http://www.crosswinds.net/~llizard --> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin var agt=navigator.userAgent.toLowerCase(); if (agt.indexOf("mac") != -1) var a="\r"; else var a="\n"; var max=0; function tlist() { max=tlist.arguments.length; for (i=0; i this[i]=tlist.arguments[i]; } tl = new tlist( " o"+a+ " /|\\"+a+ " */ \\* ejm97"+a, " o_"+a+ " \<| *"+a+ " *\>\\ ejm97"+a, " _o/*"+a+ " * |"+a+ " / \\ ejm97"+a, " *\o_"+a+ " / *"+a+ " \<\\ ejm97"+a, " _o/*"+a+ " * |"+a+ " / \\ ejm97"+a, " *\\c/*"+a+ " )"+a+ " / \> ejm97"+a, " *"+a+ " \\__/c"+a+ " \> \\* ejm97"+a, " __/"+a+ " (o_*"+a+ " \\* ejm97"+a, " \\ /"+a+ " |"+a+ " */o\\* ejm97"+a, " \\_"+a+ " ("+a+ " */o\\* ejm97"+a, " \<_"+a+ " __("+a+ " * o|* ejm97"+a, " /_"+a+ " __("+a+ " * o|* ejm97"+a, " ___"+a+ " *\/ \>"+a+ " o|* ejm97"+a, " *"+a+ " o|_/"+a+ " */ \\ ejm97"+a, " *"+a+ " _o|_"+a+ " * \>\\ ejm97"+a, " _o/*"+a+ " * |"+a+ " / \\ ejm97"+a, " *\\o/*"+a+ " |"+a+ " / \\ ejm97"+a, " c/*"+a+ " \<\\"+a+ " */\\ ejm97"+a, " c__"+a+ " \<\ *"+a+ " */\\ ejm97"+a, " c__"+a+ " /\ *"+a+ " * /\> ejm97"+a, " c/*"+a+ " /(__"+a+ " * / ejm97"+a, " __o/*"+a+ " * (__"+a+ " \< ejm97"+a, " __o_"+a+ " * / *"+a+ " \<\\ ejm97"+a, " *_o_"+a+ " | *"+a+ " \< \\ ejm97"+a, " *_c_*"+a+ " |"+a+ " \>\\ ejm97"+a, " *_c_*"+a+ " |__"+a+ " \> ejm97"+a, " *_c_*"+a+ " __|__"+a+ " ejm97"+a, " "+a+ " *_c_*"+a+ " __)__ ejm97"+a, " "+a+ " *\\c/*"+a+ " __)__ ejm97"+a ); var x=0; function tick() { document.animation.cheerleader.value = " " + a + tl[x]; x++; if (x != max) setTimeout("tick()", 200); else x = 0; } // End --> </script>
</head>
<body onload="tickundefined)">
<center>
<form name='animation'>
<textarea name='cheerleader' rows='5' cols='20'></textarea><br>
<input type='button' value="Start Again" onclick ='' "javascript:tickundefined)">
</form>
</center></html>
6. Faking Textarea on Typing
This funny script made to prove that you’re too trusting of people. Don’t believe me? Just check it by yourself.
Code:
<html>
<head>
<script language="JavaScript"> <!-- Web Site: http://www.crosswinds.net/~llizard --> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> <!-- Begin var agt=navigator.userAgent.toLowerCase(); if (agt.indexOf("mac") != -1) var a="\r"; else var a="\n"; var max=0; function tlist() { max=tlist.arguments.length; for (i=0; i this[i]=tlist.arguments[i]; } tl = new tlist( " o"+a+ " /|\\"+a+ " */ \\* ejm97"+a, " o_"+a+ " \<| *"+a+ " *\>\\ ejm97"+a, " _o/*"+a+ " * |"+a+ " / \\ ejm97"+a, " *\o_"+a+ " / *"+a+ " \<\\ ejm97"+a, " _o/*"+a+ " * |"+a+ " / \\ ejm97"+a, " *\\c/*"+a+ " )"+a+ " / \> ejm97"+a, " *"+a+ " \\__/c"+a+ " \> \\* ejm97"+a, " __/"+a+ " (o_*"+a+ " \\* ejm97"+a, " \\ /"+a+ " |"+a+ " */o\\* ejm97"+a, " \\_"+a+ " ("+a+ " */o\\* ejm97"+a, " \<_"+a+ " __("+a+ " * o|* ejm97"+a, " /_"+a+ " __("+a+ " * o|* ejm97"+a, " ___"+a+ " *\/ \>"+a+ " o|* ejm97"+a, " *"+a+ " o|_/"+a+ " */ \\ ejm97"+a, " *"+a+ " _o|_"+a+ " * \>\\ ejm97"+a, " _o/*"+a+ " * |"+a+ " / \\ ejm97"+a, " *\\o/*"+a+ " |"+a+ " / \\ ejm97"+a, " c/*"+a+ " \<\\"+a+ " */\\ ejm97"+a, " c__"+a+ " \<\ *"+a+ " */\\ ejm97"+a, " c__"+a+ " /\ *"+a+ " * /\> ejm97"+a, " c/*"+a+ " /(__"+a+ " * / ejm97"+a, " __o/*"+a+ " * (__"+a+ " \< ejm97"+a, " __o_"+a+ " * / *"+a+ " \<\\ ejm97"+a, " *_o_"+a+ " | *"+a+ " \< \\ ejm97"+a, " *_c_*"+a+ " |"+a+ " \>\\ ejm97"+a, " *_c_*"+a+ " |__"+a+ " \> ejm97"+a, " *_c_*"+a+ " __|__"+a+ " ejm97"+a, " "+a+ " *_c_*"+a+ " __)__ ejm97"+a, " "+a+ " *\\c/*"+a+ " __)__ ejm97"+a ); var x=0; function tick() { document.animation.cheerleader.value = " " + a + tl[x]; x++; if (x != max) setTimeout("tick()", 200); else x = 0; } // End --> </script>
</head>
<body onload="tickundefined)">
<center>
<form name='animation'>
<textarea name='cheerleader' rows='5' cols='20'></textarea><br>
<input type='button' value="Start Again" onclick ='' "javascript:tickundefined)">
</form>
</center></html>
7. Unclosable Window
Yeah, you should recheck your mind carefully before run this script, maybe it will not be funny; and you have to enable popup for this damn script, lol.
Code:
<html>
<head>
<title>Unclosable Window</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="copyright" content="JavaScriptBank.com" />
<script language=JavaScript>
/*
Source of MainPart: Stefan Münz, Selfhtml 7.0, tecb.htm
*/
activ = window.setInterval("Farbe()",100);
i = 0, farbe = 1;
function Farbe() {
if(farbe==1) {
document.bgColor="FFFF00"; farbe=2; }
else {
document.bgColor="FF0000"; farbe=1; }
i = i + 1;
//if you don't want to freeze the browser uncommend the next two lines
//if(i >= 50)
//window.clearInterval(activ);
}
function erneut(){
window.open(self.location,'');
}
window.onload = erneut;
</script>
</head>
<body>
<h1>Unclosable Window</h1>
</body>
</html>
8. Shaking the browser window for a while
Change the dimension of your browser window to Normal mode, maybe a half of the screen resolution is best; then run the code below by pasting it into the address bar and codessing the Enter key.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 Tester
A small JavaScript to test the love compatibility’ between two people. I & this script are not responsible for any broken relationship you tried, lol.
Source:
<html>
<head>
<title>Love Tester</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="distribution" content="Global" />
<meta name="copyright" content="JavaScriptBank.com" />
</head>
<body>
<center>
<h1>Love Tester</h1>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function calc() {
first = document.loveform.name1.value.toUpperCase();
firstlength = document.loveform.name1.value.length;
second = document.loveform.name2.value.toUpperCase();
secondlength = document.loveform.name2.value.length;
var LoveCount=0;
for (Count=0; Count < firstlength; Count++) {
letter1=first.substring(Count,Count+1);
if (letter1=='L') LoveCount+=2;
if (letter1=='O') LoveCount+=2;
if (letter1=='V') LoveCount+=2;
if (letter1=='E') LoveCount+=2;
if (letter1=='Y') LoveCount+=3;
if (letter1=='O') LoveCount+=1;
if (letter1=='U') LoveCount+=3;
}
for (Count=0; Count < secondlength; Count++) {
letter2=second.substring(Count,Count+1);
if (letter2=='L') LoveCount+=2;
if (letter2=='O') LoveCount+=2;
if (letter2=='V') LoveCount+=2;
if (letter2=='E') LoveCount+=2;
if (letter2=='Y') LoveCount+=3;
if (letter2=='O') LoveCount+=1;
if (letter2=='U') LoveCount+=3;
}
amount=0;
if (LoveCount> 0) amount= 5-((firstlength+secondlength)/2)
if (LoveCount> 2) amount= 10-((firstlength+secondlength)/2)
if (LoveCount> 4) amount= 20-((firstlength+secondlength)/2)
if (LoveCount> 6) amount= 30-((firstlength+secondlength)/2)
if (LoveCount> 8) amount= 40-((firstlength+secondlength)/2)
if (LoveCount>10) amount= 50-((firstlength+secondlength)/2)
if (LoveCount>12) amount= 60-((firstlength+secondlength)/2)
if (LoveCount>14) amount= 70-((firstlength+secondlength)/2)
if (LoveCount>16) amount= 80-((firstlength+secondlength)/2)
if (LoveCount>18) amount= 90-((firstlength+secondlength)/2)
if (LoveCount>20) amount=100-((firstlength+secondlength)/2)
if (LoveCount>22) amount=110-((firstlength+secondlength)/2)
if (firstlength==0 || secondlength==0) amount= "Err";
if (amount < 0) amount= 0;
if (amount >99) amount=99;
document.loveform.output.value=amount+"%";
}
// End -->
</script>
<form name=loveform>
<input value="Bill Clinton" name="name1" type="text" size="20"> +
<input value="Monica Lewinsky" name="name2" type="text" size="20"> =
<input value="" name="output" type="text" size="6">
<br>
<br>
<input value="Calculate!" name="calculate" type="button" value="calculate"
onclick="calcundefined)">
</form>
</center>
</body>
</html>
No comments:
Post a Comment