Forum Moderators: open
onclick="document.getElementById('origImage').src='2ndImage.png';"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<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>oscillations</title>
<style type="text/css">
#button {
width:150px;
padding:5px 0;
border:1px solid #999;
text-align:center;
cursor:pointer;
background-color:#f0f0f0;
}
</style>
<script type="text/javascript">
function swap(){
var obj0=document.getElementById('button');
var obj1=document.getElementById('pic');
var flag=true;
obj0.onclick=function() {
flag==true?
(obj1.src='image2.jpg',obj0.firstChild.nodeValue='1st image',flag=false):
(obj1.src='image1.jpg',obj0.firstChild.nodeValue='2nd image',flag=true);
}
}
window.addEventListener?
window.addEventListener('load',swap,false):
window.attachEvent('onload',swap);
</script>
</head>
<body>
<div id="button">2nd image</div>
<div>
<img id="pic" src="image1.jpg" alt="">
</div>
</body>
</html>
function swap(){
var obj0=document.getElementById('hoursarea'); /* id for clickable image-map area */
var obj1=document.getElementById('myimage'); /* id for primary image */
var flag=true;
obj0.onclick=function() {
flag==true?
(obj1.src='images/webhours.png',flag=false): /* secondary image */
(obj1.src='images/mainpage.png',flag=true); /* primary image */
}
}
window.addEventListener?
window.addEventListener('load',swap,false):
window.attachEvent('onload',swap);
<img id="myimage" src="Images/mainpage.png">
<img name="hoursmap" src="Images/hours_map_menu.png" usemap="#hours">
<map name="hours">
<area id="hoursarea" shape="rect" coords="2,2,105,42" onmouseover="activate1()" onmouseout="deactivate1()">