Home|Sitemap|Contact

How can you show image buttons when you mouse over the parent button?




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">

<head>
<title>Image Buttons</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="author" content="Roderick Divilbiss">
<meta name="copyright" content="© 2005, 2006 Roderick Divilbiss">
<script type="text/javascript">
<!--
function showSub() {
    document.getElementById('sub1').style.display='block';
}

function hideSub1() {
    document.getElementById('sub1').style.display='none';
}

function hideSub() {
    setTimeout('hideSub1();',2000);
}

function clickSub() {
    if (document.getElementById('sub1').style.display=='block') {
        document.getElementById('sub1').style.display='none';
    } else {
        document.getElementById('sub1').style.display='block';
    } 
}

function clickImg(img) {
    document.getElementById('sub1').style.display='none';
    alert('image '+img+' clicked.');
}
//-->
</script>
<noscript>
  You do not have JavaScript enabled and can not use this page.
</noscript>
<style>
<!--
#sub1 {
    display:none;
}
-->
</style>
</head>

<body>
<p><img border="0" src="images/pic1.GIF" width="100" height="100" onmouseover="showSub();" onmouseout="hideSub();" onclick="clickSub();"><p><div id="sub1"><a href="javascript:void(0);" onclick="clickImg(2);"><img border="0" src="images/pic2.GIF" width="100" height="100"></a> <a href="javascript:void(0);" onclick="clickImg(3);"><img border="0" src="images/pic3.GIF" width="100" height="100"></a></div></div>
</body>

</html>