Idea behind this is to get all images of current webpage and change the picture shown with Javascript.
<html>
<head>
<title>Looping through IMG-tags example</title>
<script type="text/javascript">
function getImages()
{
var images = document.getElementsByTagName("IMG");
var numOfImages = images.length;
var origImage;
for(i=0;i<numOfImages;i++)
{
origImage = images[i].src;
images[i].src="http://www.google.com/ig/images/igoogle_logo_sm.gif";
images[i].alt="Original image used is " + origImage;
}
}
window.onload = getImages;
</script>
</head>
<body>
<img src="http://www.lo.fi/goo.gif" height="55" width="166">
<img src="http://www.lo.fi/gaa.gif" height="55" width="166">
</body>
</html>
Ei kommentteja:
Lähetä kommentti