Hi there taly88,
and a warm welcome to these forums. 
Here is a basic example...
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<base href="http://www.coothead.co.uk/images/">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="language" content="english">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title></title>
<style type="text/css">
body {
background-color:#c0c0c0;
}
#myimage {
display:block;
width:360px;
height:280px;
border:3px double #000;
margin:auto;
cursor:pointer;
}
</style>
<script type="text/javascript">
function swapImage(){
test=true;
obj=document.getElementById('myimage');
obj.onclick=function() {
test=(test==true)?
(obj.src='banana.jpg',test=false):
(obj.src='apple.jpg',test=true);
}
}
if(window.addEventListener){
window.addEventListener('load',swapImage,false);
}
else {
if(window.attachEvent){
window.attachEvent('onload',swapImage);
}
}
</script>
</head>
<body>
<div>
<img id="myimage" src="apple.jpg" alt="apple">
</div>
</body>
</html>
coothead
Bookmarks