首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

急救!解决思路

2012-02-07 
急救!!!!!HTMLHEADMETANAME Generator CONTENT EditPlus METANAME Author CONTENT

急救!!!!!
<HTML>
<HEAD>

<META   NAME= "Generator "   CONTENT= "EditPlus ">
<META   NAME= "Author "   CONTENT= " ">
<META   NAME= "Keywords "   CONTENT= " ">
<META   NAME= "Description "   CONTENT= " ">
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "> </HEAD>
<BODY   bgcolor= "#ff6c00 ">
<div   id=AdRotator> </div>
<SCRIPT   LANGUAGE= "JavaScript ">
<!--
function   adRotator()   {};
adRotator.initialize=function(o)
{
//   script   by   blueDestiny
this._t   =   new   Array();
this._l   =   new   Array();
this._p   =   new   Array();
this._i   =   new   Image();
this._c   =   0;
this._f   =   false;
this._o   =   o;
this._timeout   =   null;
this._html   =   " ";
//   configration.
//   @   image   width
//   @   image   height
//   @   rotator   speed
//   @   filter   type
this._w   =   200;
this._h   =   133;
this._s   =   4;
this._x   =   23;
return   this;
};
adRotator.add=function(p,t,l)   {   with   (this)
{
_p.push(p);
_t.push(t);
_l.push(l);
}};
adRotator.load=function()   {   with   (adRotator)
{
if(   _i.readyState== 'complete '   )
{
if(_p.length-1==_c)
{
_f   =   true;
_c   =   0;
window.clearTimeout(_timeout);
//getRef( "AdRotator ").innerHTML= "complete ";
adRotator.play();
}
else
{
_c++;
getRef(_o).innerHTML= "total   images   "   +   _p.length   +   ",   loading   picture   "   +   _c   +   '   '   +   _i.readyState   +   "... ";
_timeout=window.setTimeout(adRotator.load,10)
}
}
else
{
getRef(_o).innerHTML= "total   images   "   +   _p.length   +   ",   loading   picture   "   +   _c   +   '   '   +   _i.readyState   +   "... ";
_timeout=window.setTimeout(adRotator.load,10)
}
}};
adRotator.play=function()   {   with   (adRotator)
{
if(   _f   )
{
_html   =   " ";
_html   +=   ' <table   style= "border:1px   solid   #ffffff; "> <tr> <td   style= "font-size:9pt;font-family:tahoma;font-weight:bold; "> '
_html   +=   ' <div   id= "rotatorPlayer " '
+   '   style= "width: '   +   _w   +   ' '
+   ';height: " '   +   _h   +   ' " '
+   '> '
_html   +=   ' <a   href= " '   +   (   _l[_c]   ?   _l[_c]   :   "javascript:void(0   target=_blank); "   )   +   ' "> ';
_html   +=   ' <img   border=0   id= "rotatorPic "   src= " '   +   _p[_c]   +   ' " '


+   '   width= " '   +   _w   +   ' " '
+   '   height= " '   +   _h   +   ' " '
+   (_t[_c]? '   title= " '   +   _t[_c]   +   ' " ': ' ')
+   '   style= "border:1px   solid   #990000;FILTER:revealTrans(transition= '   +   _x   +   ',duration=1); " '
+   '   > ';
_html   +=   (_t[_c]?( ' <div   align= "center "> '   +   (_c+1)   +   '.   '   +   _t[_c]   +   ' </div> '): ' <p> </p> ');
_html   +=   ' </a> ';
_html   +=   " </div> ";
_html   +=   ' <div   align= "right "> ';
for(var   i=0;   i <_p.length;   i++)
_html   +=   ' <span '
+   '   style= "border:1px   solid   #ffffff;padding:1px   5px   1px   5px;height:20px;text-align:center;cursor: '
+   (_c==i   ?   ( 'default;background-color:#990000; " ')   :   'hand; "   onclick= "adRotator.select( '   +   i   +   ') " ')
+   '> <font   color=#ffffff> '
+   (i> 8?(i+1):( '0 '+(i+1)))+   ' </span>   ';
_html   +=   " </div> </td> </tr> </table> ";
getRef(_o).innerHTML   =   _html;
getRef( "rotatorPic ").filters[0].Apply();
getRef( "rotatorPic ").filters[0].Play();
next();
}
else
{
_i.src   =   _p[_c];
adRotator.load();
}
}};
adRotator.next=function()   {   with   (this)
{
(_p.length-1==_c)   ?   _c=0   :   _c++;
_timeout=window.setTimeout(adRotator.play,_s*1000);
}};
adRotator.select=function(i)   {   with   (this)
{
window.clearTimeout(_timeout);
_c=i;
adRotator.play();
}};
adRotator.set=function(second)   {   with   (this)
{
window.clearTimeout(_timeout);
if((/\d+/).test(second)==true)
{
_s=second;
adRotator.play();
}
else
{

adRotator.play();
}
}};
function   getRef(id)
{
return   (document.all?document.all(id):document.getElementById(id));
}
adRotator.initialize( "AdRotator ");


adRotator.add( "d:\\1.jpg ")
adRotator.add( "d:\\2.jpg ")
adRotator.add( "d:\\3.jpg ")
adRotator.add( "d:\\4.jpg ")
adRotator.add( "d:\\5.jpg ")

adRotator.play();
//-->
</SCRIPT>
</BODY>
</HTML>


为什么加载图片我用虚拟路径不行呀??
只能用绝对路径呀!!!!
高手们帮一下忙呀!!!!
我想用虚拟路径!!!!!

[解决办法]
是相对路径吧,相对路径是以当前文件为参照的。如图片和当前文件在同一目录,用1.jpg就行了。向下的话:images/1.jpg(images文件夹和当前文件在同一目录)。向上:../images/1.jpg(images文件夹和当前文件的父目录在同一目录下)。

热点排行