Javascript rollover image vallidation issue
hi....again!
i trying add rollover images using cs6 code places on page won't vallidate , gives heap of errors.
can advise me how attach code seperate sheet index page vallidates? or there way hide script vallidation can't see it?
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="photography portfolio using both nikon d3200 , canon ixus 65" />
<meta name="keywords" content="portfolio,pictures,camera,lenses,photography,photo,informative,functional,evolvi ng,expanding,pics,new,photographer,hobby,john,mackinnon,images,eye,catching,colourful,blac k,white
" />
<meta name="author" content="john mackinnon" />
<meta name="robots" content="index, follow" />
<meta name="revisit-after" content="3 month" />
<title>jmacphot.com landing page</title>
<!-- photography, portfolio, personal -->
<link rel="shortcut icon" href="images/favicon.ico" />
<link href="css/layout.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
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]; (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];}
}
</script>
</head>
<body bgcolor="#000000" onload="mm_preloadimages('images/on.png','images/ps_on.png')">
<div align="center">
<p><img src="images/landing.jpg" alt="landing" width="800" height="400" usemap="#map" border="0" />
<map name="map" id="map">
<area shape="rect" coords="284,251,477,289" href="home.html" alt="#" />
</map>
</p>
<p><a href="#" onmouseout="mm_swapimgrestore()" onmouseover="mm_swapimage('flash','','images/on.png',1)"><img src="images/off.png" width="190" height="100" id="flash" /></a><a href="#" onmouseout="mm_swapimgrestore()" onmouseover="mm_swapimage('photoshop','','images/ps_on.png',1)"><img src="images/ps_off.png" width="190" height="100" id="photoshop" /></a></p>
</div>
</body>
</html>
cheers
john
i not sure 'flash' , 'photoshop' have in common rollover images.
may suggest use jquery solve problem.
to this, need link library document in
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
the markup like
<img src='/folder/image1.jpg' id='imageid'/>and js like
<script>
$('#imageid').hover(function() {
$(this).attr('src', '/folder/image2.jpg');
}, function() {
$(this).attr('src', '/folder/image1.jpg');
});</script>
More discussions in Dreamweaver support forum
adobe
Comments
Post a Comment