Code:
<script type="text/javascript">
onload = function() {
for(var i = 0, es = document.images, n = es.length, e = es[0]; i < n; e = es[++i]) {
var m = e.className.match(/swap\((\w+), ([\w\/\.:%]+)\)/);
if(m)
e['on' + m[1]] = (function(n) {
return function() {
var oldsrc = this.src;
this.src = n;
n = oldsrc;
};
})(m[2]);
}
e = es = null;
};
</script>
</head>
<body>
<p>
<img alt="Something" src="image1.gif" class="swap(click, image2.gif)">
You can use as many images as you like in that format (theoretically, I haven't tested it).
Bookmarks