View Single Post
Old 09-18-2012, 07:24 PM   PM User | #1
hcrosex3
New Coder

 
Join Date: Sep 2012
Posts: 32
Thanks: 10
Thanked 0 Times in 0 Posts
hcrosex3 is an unknown quantity at this point
How do you highlight an image on mouse over?

I currently have the opacity set at 40. How can I create an event to highlight the image on mouseover.

Code:
<!DOCTYPE html PUBLIC 
"-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title>Product Page</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> 

<script type = "text/javascript">
//<![CDATA[
<!--hide from incompatible browsers



function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

 //stop hiding -->
//]]>

</script>

<style type="text/css">
<!--
        body {background-color: #ffffff;}
        p { font: 1em Times serif; color: #000; }
        h2 { font: 2em Times serif; color: #000; }
        div.main {background-color: ffffff;}
    div.product {
        border-bottom: 1px black dashed;
        background-color: #CCC;
        padding: 5px;
        filter:alpha(opacity=40);
    opacity:.4;
        


-->
</style>

</head>

<body onload="MM_preloadImages('umph.png')">
<div class = "main" style = "width: 800px">

        <h2>Some of Our Really Cool Products</h2>
        <hr>
        
        <div class = "product">
        <p><a href="#"  onclick="MM_swapImage('Image5','','umph.png',1)" onmouseout="MM_swapImgRestore()"><img src="image1.png" width="88" height="64" border="0" id="Image5"  /></a>Brick</p>
        </div>
  <div class = "product"
        <p><img src = "image2.png">Slope</p>
        </div>
        <div class = "product"
        <p class="out"><img src = "image3.png">Wall</p>
        </div>
<div class = "product"
        <p><img src = "image4.png">Spoked Wheel</p>
        </div>
        
        <h2>You should buy them!</h2>

</div>




</body>

</html>

Last edited by hcrosex3; 09-18-2012 at 07:28 PM..
hcrosex3 is offline   Reply With Quote