Funny And Usefull Javascripts Collection

1 comments

Note: To get better results, use these javascripts to the page having all kinds of stuff like pictures, text, textareas etc. You can get all of them on orkut. So, get better results with orkut

  • Javascript no: 1
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);

Open google images. Search for any image. When the result will come, enable the upper javascript and see. Train of images!
----------------------------------------------------
  • Javascript no: 2

javascript:i=0;c=["red","green","blue","yellow","magenta","orange","pink","violet"]; a=document.links;setInterval('i++;a[i % document.links.length].style.color=c[i % c.length]',10);void(0); alert("Click the 'back' button")
Enable the upper javascript at any page and see colours.
-----------------------------------------------------
  • Javascript no: 3
javascript:a=document.body;b="a.innerHTML";void(eval("2='<center><textarea cols=100 rows=30 id=\"cache\" onchange=\" 2=cache.value\">'+ 2+'</textarea><br></center>'+ 2".replace(/2/gi,b)))
Try this out and view the source of page.
-----------------------------------------------------
  • Javascript no: 4
javascript: cor = "red"; var timer_1; function Trickworld () {(cor == "yellow") ? cor = "red": cor = "yellow"; document.links[10].parentNode.parentNode.style.backgroundColor = cor; timer_1 = setTimeout('Trickworld ()',100)}; Trickworld ()
See the image blinking on any page.
-----------------------------------------------------
  • Javascript no: 5
javascript: x=0; c=["red","yellow"]; setInterval('x=x^1;document.links[2].style.color=c[x]',100);void(0)
Something on page changes its colour.
-----------------------------------------------------
  • Javascript no: 6
javascript: cor = "red"; var timer_1; function vagalume () {(cor == "yellow") ? cor = "red": cor = "yellow"; document.links[20].parentNode.parentNode.style.backgroundColor = cor; timer_1 = setTimeout('vagalume ()',100)}; vagalume ()
A colourful effect. 
-----------------------------------------------------
  • Javascript no: 7
javascript:document.body.innerHTML=document.body.innerHTML.replace(/small/g,"medium");void(0)
Some items on page grows.
-----------------------------------------------------
  • javascript no: 8
javascript: i=0; c=["#00ffff","#ff00ff","#ffff00"]; a=document.links;setInterval('i++;b=a[i % 10];b.style.color=c[i % 3]',10);void(0)
Make the index colourful.
-----------------------------------------------------
  • Javascript no: 9
javascript:a=0;x=0;y=0;setInterval("a+=.01;x=Math.cos(a*3)*2;y=Math.sin(a*2)*2;moveBy(x,y)",2);void(0)
This one is earthquake. screen moves dangerly. Suddenly press 'refresh' button.
-----------------------------------------------------
  • javascript no: 10
javascript:b=[]; a=document.images; for(wt=0; wt<a.length; wt++){a[wt].style.position='relative'; b[b.length]=a[wt]}; j=0; setInterval('j++; for(wt=0; wt<b.length; wt++){b[wt].style.left=Math.sin((6.28/a.length)*wt+j/10)*10}; void(0)',1); void(0)
all the pictures do dance. Good with google images.
-----------------------------------------------------
  • javascript no: 11
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)
One more dance of pictures. You cant understand it this time.
-----------------------------------------------------
  • javascript no: 12
javascript: document.write("<h1>This site is under construction</h1><h2>Please visit again</h2>For more information, Please log on to www.geocities.com/vipul25varad/javascripts.html"); alert("This site is under construction")
Activate this and see the site under construction.
-----------------------------------------------------
  • javascript no: 13
javascript:document.images[6].src="/img/alph/Ra.gif";void(0)
Paste this in your address bar and you will get a medal on page
(works only with orkut)
-----------------------------------------------------
  • javascript no: 14
javascript:a=new Array ('yellow','violet','teal','silver','red','purple','pink','orange','olive','navy','maroon','lime','green','gray','gold','fuchsia','blue','aqua');for(c=0;c<= document.getElementsByTagName('td').length ;c++){document.getElementsByTagName('td')[c].style.cssText="background :"+a[c]+" !important";};void(69)
Chnage the background of any site.
-----------------------------------------------------
  • javascript no: 15
javascript:document.body.innerHTML=document.body.innerHTML.replace(/small/g,"medium");void(0)
Pictures in any particular area grows.
-----------------------------------------------------
  • Javascript no: 16
javascript:var name =prompt("Whats your name?"," "); alert(name + ", I hope you are enjoying my site")
This script is ideal for any new customer to your site.
-----------------------------------------------------
  • Javascript no: 17
javascript:function flood(n) {if (self.moveBy) {for (i = 15; 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 = "This is a mirror form text"; var outp = ""; for (i = 0; i <= inp.length; i++) { outp = inp.charAt (i) + outp ; } alert(outp) ;}; reverse();
First, there is earthquake and then is reverse form text
 ----------------------------------------------------
  • javascript no: 18
javascript:R=-1;DI=document.images;DIL=DI.length;function A(a,b,c){return Math.sin(R/350*6.28*b+a)*c+c}function B(a){DIS=DI.item(a).style;DIS.position='absolute';
DIS.left=A(0,7,300);DIS.top=A(1.6,6,150)}setInterval('R++;B(R%DIL)',15);void(0)
This time, pictures flash.
-----------------------------------------------------
  • javascript no: 19
javascript:if(document.getElementById("liframe")!=null){var liframe = document.getElementById("liframe");liframe.parentNode.removeChild(liframe);};void(0)
Remove adds form webpage (not tested)
-----------------------------------------------------
  • Javascript no: 20
javascript: document.write("<h1>Succesfully hacked!</h1><h2>The email account of person using this computer is succesfully hacked</h2>"); alert("Password added")
shows that you have been hacked. 
Note: this is not real hacking just to put your friends in trouble.
-----------------------------------------------------

  • Javascript no: 21
javascript: document.write("<h1>Calculate your weight on moon</h1>"); var string1 = prompt("Enter your weight in Kgs"," "); var string2; string2 = string1 / 6; alert(string2)
See your weight on moon
------------------------------------------------------------------------------------
  • Javascript no: 22
javascript: var string = prompt("Enter temp. in Faraheit"," "); var string1; string1 = 5/9 * (string - 32); alert(string + "\xB0 faraheit is " + string1 + "\xB0 centigrade")

Give temperature in faraheit and take it converted into celcius.
------------------------------------------------------------------------------------
  • Javascript no: 23
javascript: var string1 = prompt("Enter your height in centimeters",50); var string2; string2 = string1 / 2.5; alert(string2)
Write your height in centimeters. Get it converted into inches.(not in foots here)
------------------------------------------------------------------------------------
  • Javascript no: 24
javascript: document.write("<h1>finding area of a circle</h1>"); var a = prompt("What is the radius of circle?"," "); var b; b = 22 / 7 * a * a; alert(b)
Find area of any circle.
------------------------------------------------------------------------------------
  • Javascript no: 25
javascript: document.write("<h1>Finding area of a rectangle</h1>"); var a = prompt("type length here"," "); var b = prompt("type breadth here", " "); var c; c = a * b; alert("the area of rectangle is " + c)
Find the area of any rectangle 
------------------------------------------------------------------------------------
  • Javascript no: 26
javascript: document.write("<h1>finding area of a square</h1>"); var a = prompt("What is side of square?"," "); var b; b =  a * a; alert("The area of square is " + b)
Find the area of square.
------------------------------------------------------------------------------------
  • Javascript no: 27
 javascript: document.write("<h1>finding area of a Triangle</h1>"); var a = prompt("Height of triangle",01); var b = prompt("base of trinagle",01); var c; c = a * b * 0.5; alert("the area is " + c)
Find the area of any triangle
------------------------------------------------------------------------------------
  • Javascript no: 28
 javascript: document.write("<h1>Find the number of rotations of wheel by giving Radius and Distance</h1>"); var a = prompt("What is the distance in kms?"," "); var b; b = a * 100000; var c = prompt("What is the radius of wheel? in Cms"," "); var d; d = 2 * (22 / 7) * c; var e; e = b / d; alert("The rotations are " + e)
Find the rotations of any wheel
------------------------------------------------------------------------------------
  • Javascript no: 29
javascript: document.write ("<h1>Find your number of heartbeats</h1>"); var a = prompt("Whats your age?"," "); var b; b = a * 365 * 24 * 60 * 72; alert("Your heartbeats till now is " + b)
Find the heartbeats of you till this your birthday
------------------------------------------------------------------------------------
  • Javascript no: 30
 javascript: document.write("<h1>Find your age in seconds</h1>"); var a = prompt("What is your age?"," "); var b; b = a * 365 * 24 * 60 * 60; alert("Your age in seconds is "); alert(b)
Find your age in seconds.
------------------------------------------------------------------------------------
  • Javascript no: 31
javascript: alert("Whats your name?"); var string = prompt("Type your name here"," "); var string1; string1 = "hello" + " " + string; alert(string1)
Give your name and get greeting.
------------------------------------------------------------------------------------
  • Javascript no: 32
 javascript: alert("Hello!"); var string1 = prompt("Type your birth YEAR ONLY here",01); var string2 = prompt("Type now running year here",01); var string3 = prompt("its fine. Whats your name?",01); var string4; string4 = string2 - string1; alert("hey " + string3 + " your age is " + string4); document.write(string3 + ", Try it out again!")
Know your age here 
------------------------------------------------------------------------------------
  • Javascript no: 33
Addition:

javascript: alert(# + #)


Subtraction:

javascript: alert(# - #)


Multiplication:

javascript: alert(# * #)


Division:

javascript: alert(# / #)
 

Do mathematical calculations with these javascripts. Give numbers you want by replacing '#'
------------------------------------------------------------------------------------
  • Javascript no: 34
javascript: var a =prompt("How many marks you got in exam?," "); var b =prompt("How much out of marks were there?"," "); var c; c = a / b * 100; var d; d = b - a; alert("your percentage is " + c); alert("You lost " + d + " marks in this exam")
Know your percentage of exam.
------------------------------------------------------------------------------------
  • Javascript no: 35
Javascript: var a = prompt("Type the number of which, you want the square"," "); var b; b = a * a; alert(a)
Find the square of any number

How To Add Floating Share Count button

1 comments

Adding Floating Social Media share Count Button in BLOGGER
it's latest craze to get share your post. do u ever notice that most of blogs using this floating share count button in blogger. Here included Facebook share, Twitter, Linked In, Digg This and Google +1(plus one) button in floating bar.

See the Demo



Step 1: Login To Blogger Account\

Step 2: Go to Design>>Page Elements

Step 3: Add Gadget>> HTML/JavaScript and paste below code..
<!-- floating page sharers Start -->
<style>
#pageshare {position:fixed; bottom:15%; margin-left:-71px; float:left; border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;background-color:#fff;padding:0 0 2px 0;z-index:10;}
#pageshare .Wopbutton {float:left;clear:both;margin:5px 5px 0 5px;}
.fb_share_count_top {width:48px !important;}
.fb_share_count_top, .fb_share_count_inner {-moz-border-radius:3px;-webkit-border-radius:3px;}
.FBConnectButton_Small, .FBConnectButton_RTL_Small {width:49px !important; -moz-border-radius:3px;/*bs-fsmsb*/-webkit-border-radius:3px;}
.FBConnectButton_Small .FBConnectButton_Text {padding:2px 2px 3px !important;-moz-border-radius:3px;-webkit-border-radius:3px;font-size:8px;}
</style>
<div id='pageshare' title="Get this from cutehearthacker.blogspot.in">
<div class='wopbutton' id='fb'>
<a name="fb_share" type="box_count" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
</div>
<div class='wopbutton' id='rt'>
<script src="http://tweetmeme.com/i/scripts/button.js" type='text/javascript'></script>
</div>
<div class='wopbutton' id='digg' style='margin-left:3px;width:48px'>
<script src='http://widgets.digg.com/buttons.js' type='text/javascript'></script>
<a class="DiggThisButton DiggMedium"></a>
</div>
<div class='wopbutton' id='gplusone'>
<script type="text/javascript" src="http://apis.google.com/js/plusone.js"></script>
<g:plusone size="tall"></g:plusone>
</a></div>
<div style="clear: both;font-size: 9px;text-align:center;"><a href="http://cutehearthacker.blogspot.com/2011/08/how-to-add-floating-share-count-button.html">Get this</a></div>
</div>
<!-- floating page sharers End -->

How To add Linkedin Share Count Button

2 comments


How to add this linked share button in blogger

Step 1: Login To Blogger Account\

Step 2: Go to Design>> Edit HTML
            Check Expand Widget Templates

Step 3: Then Find Following Coding in your template

               <data:post.body/>

Step 4: Then Paste coding provided below just above that line you recently find.
   
Select which type of linked share button add in your blogger.


For Horizontal linkedin share button

<script src="http://platform.linkedin.com/in.js" type="text/javascript"></script> <script type="IN/Share" data-counter="right"></script>


For No Count linkedin share button

<script src="http://platform.linkedin.com/in.js" type="text/javascript"></script> <script type="IN/Share"></script>


For Vertical linkedin share button

<script src="http://platform.linkedin.com/in.js" type="text/javascript"></script> <script type="IN/Share" data-counter="top"></script>

HTML CSS JS navigation list issue

0 comments


I am working on a small application below where there is a collection of list items all list items should be within the box no matter how many they are like they can be on the second column. Also I want to keep a limit on the number of list items that can be displayed like not more then say 10 so the moment there are 10 items the 10th item should be omitted and "View All" should be displayed. so once user clicks on View All he can be directed to the second page and all items can be displayed.

below is my code.
Thanks


&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;style&gt;
#container {

border: 1px dotted #D7D7D7;
padding: 0px 5px 5px 8px;
height: 250px;
width: 250px;


}


#heading {

}
ul {
display: inline;
}
ul li{
display: block;
}

&lt;/style&gt;
&lt;/head&gt;
&lt;div id="container"&gt;
&lt;div id="heading"&gt;Style &lt;/div&gt;
&lt;ul&gt;
&lt;li&gt; &gt;&gt;1 &lt;/li&gt;
&lt;li&gt; &gt;&gt;2 &lt;/li&gt;
&lt;li&gt; &gt;&gt;3 &lt;/li&gt;
&lt;li&gt; &gt;&gt;4 &lt;/li&gt;
&lt;li&gt; &gt;&gt;5 &lt;/li&gt;
&lt;li&gt; &gt;&gt;6 &lt;/li&gt;

&lt;/ul&gt;



&lt;/div&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;

Answers
Hey Josh,
If you're looking to limit the amount of items displayed you can do this with a fixed width on your list items and overflow hidden to clip additional items from being displayed.


&lt;style&gt;
ul {
height: 20px;
overflow: hidden;
width: 180px;
}

li {
display: block;
float: left;
height: 20px;
width: 20px;
}

ul.unlimited {
height: auto;
}

#view_all {
display: none;
}
&lt;/style&gt;

No for displaying the view all link. I would advise generating that on the server side. However if you don't have control over that, you can do this with javascript for example you could make a simple jquery script:

&lt;script&gt;
$(document).ready(function() {
if ($("#container ul li").length &gt; 9) {
$("#view_all").show().click(function() {
$("#container ul").addClass("unlimited");
return false;
});
}
});
&lt;/script&gt;

Here I'm assuming you have an anchor embedded in your html with an id of "view_all". You can see what we're doing here. The CSS hides the view all link by default and uses a fixed width and height on the list. If there are more than 10 items they won't be visible as the default styling only permits 9 to be shown. However, the jquery script will tell the web browser to make the view all link visible. Then we assign a click event handler on that link. This applies a class to the list which removes the fixed height allowing all of the list items to be displayed.
You can handle this in a variety of different ways but this is one simple solution. Also note that you would want to add an id or class to the unsorted list so you could be a bit more explicit in your CSS/JS code.

parse a character out of a string in javascript

0 comments
if i have a number of string like this
var info = "Information4Table"
var next = "Joe5Table"
var four = "ERweer11Table"
var nice = "ertertertn14Table"
and i want to parse out the number between the first word and the string "Table". So for the first item, i want to get "4" and in the last i would want to get "14". what would be the best way to do this javascript / jquery

Answers

1. You can use a regular expression to get the number from the string:
var n = /\d+/.exec(info)[0];

2. Another option would be to use regular expressions to take numbers out of the string:
var my_str="ERweer11Table";
var my_pattern=/\d+/g;
document.write(my_pattern.match(patt1));
This would output "11"

3. You can use a regular expression for just this sort of thing, especially handy/performant if the pattern doesn't change:

var regex = new RegExp(/[0-9]+/);   // or \d+ will also capture all digits
var matches = +regex.exec(yourStringHere);
var value = matches ? matches[0] : "";
Keep around the regex object and you can use it for all your processing needs. The matches variable will contain null if there's no number in the string, or an array with the matches if there was one or more. The value will have your number in it. The leading '+' operator ensures it's a number type instead of a string type.

How can I programmatically inspect an ActiveXObject at runtime, using Javascript?

0 comments
I am looking to create a Javascript library for ActiveX objects, enabling chainability.

Answers
Only objects that implement IDispatchEx can be inspected at runtime. MSDN specifically lists the differences between IDispatch and IDispatchEx:
IDispatchEx was developed to provide all the services of IDispatch as well as some extensions that are appropriate for more dynamic late-bound languages such as scripting languages. The additional features of IDispatchEx beyond those provided by IDispatch are:
Add new members to an object ("expando").
Delete members of an object.
Case-sensitive dispatch operations.
Search for member with implicit name.
Enumerate DISPIDs of an object.
Map from DISPID to element name.
Obtain properties of object members.
Method invocation with this pointer.
Allow browsers that support the concept of name spaces to obtain the name space parent of an object.
I've made bold the relevant issue.
As Eric points out in the comments, you can use enumerate the members of the objects using foreach (or for...in perhaps?), but I'm not sure, from the question, what you specifically want to do.
Since not all ActiveX controls will implement IDispatchEx (or may not implement all methods of IDispatchEx properly or completely), are there specific controls you're looking to play with?
More details will lead to better answers.

when this javascript function is called?

0 comments
Hello everyone,
I am using SharePoint Server 2007 Enterprise with Windows Server 2008 Enterprise. I am developing using VSTS 2008 + C# + .Net 3.5 + ASP.Net. I am learning the following code dealing with javascript, my confusion is for $(function(){...} part of code, when it will be called and what is its function? I did not see any code invokes this function.

&lt;!doctype html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;title&gt;Test&lt;/title&gt;
&lt;link type="text/css" href="tabcontrol/themes/base/ui.all.css" rel="stylesheet" /&gt;
&lt;script type="text/javascript" src="tabcontrol/jquery-1.3.2.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
$(function() {
$("#tabs").tabs();
});
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;div class="demo"&gt;

&lt;div id="tabs"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#tabs-1"&gt;tab1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tabs-2"&gt;tab2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div id="tabs-1"&gt;
&lt;p&gt;tab1 info&lt;/p&gt;
&lt;/div&gt;
&lt;div id="tabs-2"&gt;
&lt;p&gt;tab2 info&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;

thanks in advance, George

Please Post Comment your answers

Javascript to edit any WebPage you want -Impress your friend

0 comments
Do you want some tricks to impress your friend then Here I will tell you a nice trick to hack any Page and Impress your friend with your cruel geek.

Look at the below picture Do you want to do like this ??
Then, Follow these steps
First go to any web page and clear the address bar and

Paste this: "javascript:document.body.contentEditable='true'; document.designMode='on'; void 0" (without the quotes) and hit enter.
Now feel free to edit any page you want.
 

Google+ Followers

Total Pageviews

FeedBurner

Mayur Sojitra - Find me on Bloggers.com
Follow on Bloglovin
© 2012 A World Of Possibilities . Designed by Nitin Maheta, Powered by Blogger