Dynamically Swapping Images with JavaScript

In this article you will learn the numbers Swapping in JavaScript and create a JavaScript program.

Dynamically Swapping Images with JavaScript

     

In this article you will learn the numbers Swapping in JavaScript and create a  JavaScript program.

Image Swapping in JavaScript:- In JavaScript, Numbers Swapping means interchange the numbers to each other . We take two numbers first is (a=10) and second is (b=20). After the swapping the number is change to each other . Such as : a=20 and b=10.

 

The example of Swapping the numbers in JavaScript:-

<html>
<head>
<script language="javascript">
function showAlert()
{
var a,b,c;
a=10;
b=20;
document.write("Without Swapping");
document.write("a="+a);
document.write("b="+b);
c=a;
a=b;
b=c;
document.write("After swpping");
document.write("a="+a);
document.write("a="+a);
}
</script>
</head>
<body>
<script language="javascript">
showAlert();
</script>
</body>
</html>

   Output:- Without Swapping a=10 b=20 
  After Swapping a=20 b=10

 

Advertisements

 

We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.

Share on Google+Share on Google+

Dynamically Swapping Images with JavaScript

Posted on: June 16, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss: Dynamically Swapping Images with JavaScript  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:2
mvn
August 25, 2011
swap img

send me code
venkata satya kiran pyla
October 14, 2011
javascript

i want more material

Ads

 

Ads