日期:2014-05-16  浏览次数:20442 次

求高手指教.........在线等回复
我现在做个图片焦点切换,用js来写  
代码如下:

<!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=gb2312 "   />
<title> 焦点切换 </title>
<script   language= "JavaScript "   type= "text/JavaScript ">
var   img_1   =   new   Image();
img_1.src   =   "F:\焦点切换\页签小图2\页签小图2\bg_4.gif ";
var   img_2   =   new   Image();
img_2.src   =   "F:\焦点切换\页签小图2\页签小图2\cj_1.gif ";
var   img_3   =   new   Image();
img_3.src   =   "F:\焦点切换\页签小图2\页签小图2\cj_2.gif ";
var   img_4   =   new   Image();
img_4.src   =   "F:\焦点切换\页签小图2\页签小图2\cq_1.gif ";
var   img_5   =   new   Image();
img_5.src   =   "F:\焦点切换\页签小图2\页签小图2\cq_2.gif ";
var   img_6   =   new   Image();
img_6.src   =   "F:\焦点切换\页签小图2\页签小图2\cs_1.gif ";
var   img_7   =   new   Image();
img_7.src   =   "F:\焦点切换\页签小图2\页签小图2\cs_2.gif ";
var   img_8   =   new   Image();
img_8.src   =   "F:\焦点切换\页签小图2\页签小图2\dj_1.gif ";
var   img_9   =   new   Image();
img_9.src   =   "F:\焦点切换\页签小图2\页签小图2\dj_2.gif ";
var   img_a   =   new   Image();
img_a.src   =   "F:\焦点切换\页签小图2\页签小图2\sc_1.gif ";
var   img_b   =   new   Image();
img_b.src   =   "F:\焦点切换\页签小图2\页签小图2\sc_2.gif ";
var   img_c   =   new   Image();
img_c.src   =   "F:\焦点切换\页签小图2\页签小图2\zt_1.gif ";
var   img_d   =   new   Image();
img_d.src   =   "F:\焦点切换\页签小图2\页签小图2\zt_2.gif ";

function   MM_swapImgRestore()  
{  
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()  
{  
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)  
{  
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()  
{ &