Hey folks, hmmm… How can I start…. !!! Yeah, well folks… below is very simple snippet code for flipping of two images using JavaScript. If possible you guys can make it generic snippet code. This code will help in mainly for showing / hiding of div’s, for example if he clicks on ‘Show Image’ it will automatically changes to ‘Hide Image’. Its a simple snippet code.
Below is the div, in div – Initially I am showing the hide image, when user clicks on this image, the image as well as the title of the img will be swapped with show image and the title will be ‘Maximize’… and Vice-Versa.
The below function should be placed in <script></script>.
//This Function is for Flipping of 'Show Image' to 'Hide Image' and Vice-Versa
function flip(imageID) {
var img = document.getElementById(imageID);
if (img.src.indexOf('images/hide.gif') > -1) {
img.src = 'images/show.gif';
img.title='Maximize';
} else {
img.src = 'images/hide.gif'
img.title='Minimize';
}
}
below div should be placed in <body>.
<div><a href="#" onClick="flip('hide'); return false;" title="Minimize" style="padding:0px"><img src="images/hide.gif" id="hide" border="0"></a></div>
Enjoy !!!
Related Entries...
John Resig, has explained us a better and interesting way of Method Overloading. Here he has discusse ...
Making a preloader in flash is very simple. By using ProgressBar and Image Loader components, we can ...
AIR is rocking in the web world, if you guys! Search for Adobe AIR you will get tons of web snippets ...
As we all know AJAX is rocking the Web World all around, just I had a thought to developer a simple A ...
You guys might know the importance of XML, XML (Extensible Markup Language) is a flexible markup lang ...
I am back again with some helpful snippet code. Here using JavaScript we can pro actively sort date f ...
Hi Guys, I would like to share a JavaScript snippet code which will remove special characters (like ! ...
Below is the code which is written in JavaScript, we can use this script for bookmarking the particul ...
Hi Dev Folks, this topic explains you about different patterns used to match character combinations i ...
To start with, Well I think bunch of developers might have come across this situations where in which ...























Leave Your Response