FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Some funny javascript





flatliner
This is funny, when you place the code below into your browse url bar and press enter all the images from any website your on with being to fly around the place. Its quite funny Laughing

Code:
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)
flatliner
althought it doesnt work in firefox really, only fully works in IE
jabapyth
cool script! you could make it Firefox compatible by doing:

Code:
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.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++}tag=setInterval('A()',5 );document.onmousedown=function(){clearInterval(tag);for(i=0; i<DIL; i++){DI[i].style.position="static";}}; void(0)

--the difference is adding +"px" after the style top and left declarations: firefox doesn't accept raw numbers at top and left attributes.

in addition, i added a function so that when you click anywhere, the images go back to their places.
flatliner
oh right yea, nice one. yea its a pretty mad script alright Laughing
Peterssidan
No the answer button flew away :p
Very cool script! This I must try to joke with someone with this.
ThomasDesigns
Modified it to only move when your mouse is moving, as well as revolve around the mouse.

This one only seems to work in firefox, however, and can't exactly be stopped.

Working on tweaking it a little to make the images follow the mouse in a trail.

I'm pretty sure the reason IE doesn't like my script is because of the way I find the mouse coords. Any ideas?

Code:

javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=100; y4=100; var DI= document.images; DIL=DI.length; function A(_X,_Y){for(i=0; i<DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+_X+"px"; DIS.top=Math.cos(R*y1+i*y2+y3)*y4+_Y+"px"}R++}document.onmousemove=function(event){_X = event.clientX; _Y = event.clientY; A(_X,_Y);};document.onmousedown=function(){for(i=0; i<DIL; i++){DI[i].style.position="static";}};void(0)


--edit--
Can't seem to get a follower script working. Will try more later (this is fun).
ThomasDesigns
Ok, so, I have been working on making a scrpt to make all images follow the mouse in a trail. I think I am close, but I just can't quite get it to work correctly.

Heres the code I have so far, any input is appreciated.

Code:

javascript:
var acc=1; 
var DI=document.images; 
var DIL=DI.length; 
function A(){
   for(i=1;  i<DIL;  i++){
      DI[i].style.position='absolute';
      if(DI[i].style.left!=DI[i-1].style.left){   
         DI[i].style.left = DI[i].style.left+((DI[i-1].style.left-DI[i].style.left)/acc)+'px';
      } 
      if(DI[i].style.top!=DI[i-1].style.top){
         DI[i].style.top = DI[i].style.top+((DI[i-1].style.top-DI[i].style.top)/acc)+'px';
      }
   }
}
function moveFirst(event){
   var IE = document.all?true:false; 
   if(!IE){
      var _X=event.clientX;   
      var _Y=event.clientY; 
   }
   else if(IE){
      var _X=window.event.clientX;   
      var _Y=window.event.clientY; 
   }
   var DIS=DI[0].style; 
   DIS.position='absolute'; 
   DIS.left=_X;  DIS.top=_Y;
}
function Clear(){
   clearInterval(tag);
   for(i=0; i<DIL; i++){
      DI[i].style.position="static";
   }
}
document.onmousemove=moveFirst;
A();
var tag=setInterval('A()',5,'JavaScript');
document.onmousedown=Clear();
void(0);


Obviously you would need to remove the indentation and form to copy it to the URL bar, but I have it this way so that it's easier to read and debug.
bulevardi
jabapyth wrote:

Code:
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.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++}tag=setInterval('A()',5 );document.onmousedown=function(){clearInterval(tag);for(i=0; i<DIL; i++){DI[i].style.position="static";}}; void(0)



You can make it as a whole page aswel with multiple functionality.
This is done with Lists instead of images.

Check it out Smile

Code:


<html>
<head>
<title></title>
 
<script type="text/javascript">
 
function theWire(){

var theElem = document.getElementById("blokjes").getElementsByTagName("li");
var interval;
var  r =    0;
var x1 =  0.1;
var y1 = 0.05;
var x2 = 0.25;
var y2 = 0.24;
var x3 =  1.6;
var y3 = 0.24;
var x4 =  300;
var y4 =  200;
var x5 =  300;
var y5 =  200;


 function avonBarksdale(){          // start animatie   
  interval = setInterval(mcNulthy,50);
   function mcNulthy(){                   // laat de blokjes van positie veranderen
    for(var i=0; i<theElem.length; i++){
     elemStyle = theElem[i].style;
     elemStyle.position = "absolute";
     elemStyle.left = Math.sin(r*x1+i*x2+x3)*x4+x5+"px";
     elemStyle.top = Math.cos(r*y1+i*y2+y3 )*y4+y5+"px";
      }
    r++;
   }
 }


 function kima(){            // stop animatie en zet blokjes terug in positie
 clearInterval(interval);
 for(var j=0; j<theElem.length; j++){
    elemStyle = theElem[j].style;
    elemStyle.position = "relative";
    elemStyle.left = 0+"px";
    elemStyle.top = 0+"px";
    }
  r = 0;
 }


var een = document.getElementById('een');
var twee = document.getElementById('twee');

een.onclick = avonBarksdale;
twee.onclick = kima;

}
 
</script>
 
<style>
#blokjes li { display: inline; height: 20px; width: 20px; border: 1px solid #000000; margin: 5px; text-align: center; list-style-type: none; background-color: #0099FF; }
#functies li { display: block; width: 100px; border: 1px solid #000000; margin: 5px; text-align: center; list-style-type: none; }
</style>
 
</head>
<body onload="theWire();">

<ul id="functies">
<li id="een">beweeg</li>
<li id="twee">stop</li>
</ul>

<ul id="blokjes">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>

 
</body>
</html>
                     
Asap170
It's pretty funny. I did it on Apple.com because I hate Apple's products. I got a nice little chuckle out of it! Let's hope the FBI isn't after me.
cyberworlds
nice script... thankx for share
polly-gone
No! It doesn't work on Google Chrome because of the omnibar! If you put that in the address bar and hit enter, if takes you to a Google result pages using the script as the search term!

I suddenly love the omnibar slightly less.

-Nick Smile Smile Smile

Edit: Tried to include a link to the search results, but it didn't work.
nezam
Really Kool Man!
nivinjoy
I don't think this works in IE 9..
tamilparks
its not working for me in firefox
nivinjoy
tamilparks wrote:
its not working for me in firefox


I am sorry for my previous comment. Its working in IE9.

@tamilparks: Its working fine in Firefox too.
tazone
very cool, gonna share this with the world now Surprised
rmartin
wow.....its really awsome...but this is just IE...but its really amazing.
cybersa
Awesome...
But only working on IE.
Tried it on FireFox 4 but failed.
ProwerBot
Here's one for you.

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


Allows you to edit and move anything on the web page. Can be used as a great prank like on CNN.com or something. I've done this before. :p
gueda
ProwerBot wrote:
Here's one for you.

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


Allows you to edit and move anything on the web page. Can be used as a great prank like on CNN.com or something. I've done this before. :p


uhuhuh this is so funny. I will use this to make a prank too ehuehuehue
Related topics
Drag images (Javascript)
These Are Funny
The Archive of All Funny
funny pictures for sale
Pervert Psychiatrist
more funny sef movies 2
Funny Animal Pictures
Funny Flash
PB PHP, Iframe and Javascript
Clock-javascript
Lots Of Funny Pictures
javascript: needed script for displaying window
Textareas and Javascript
Question about forms on websites?
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.