我在网上下了段广告新闻轮番显示图片的代码,是这样的
<html>
<head><style type="text/css">
<!--
#f_div{width:150px; height:100px; margin:0 auto; overflow:hidden;}
#f_imgDiv{width:100%; height:100px; overflow:hidden;}
#f_img{filter:progid:DXImageTransform.Microsoft.Fade(Overlap=1.00); border:0;}
#f_infoDiv{width:100%;top:-20px !important;top:-22px; position:relative;}
#f_buttonDiv{width:100%; margin-right:1px; height:21px; overflow:hidden; text-align:left;}
#f_line{width:100%;height:1px;background:#fff; overflow:hidden;filter:progid:DXImageTransform.Microsoft.Alpha(startX=0, startY=0, finishX=50, finishY=100,style=1,opacity=0,finishOpacity=100)}
#f_buttonDiv div{width:1px;height:21px; background:#fff; float:right;}
#f_buttonDiv .bg{width:21px; height:21px; background:#fff; float:right; filter:Alpha(Opacity=40);}
#f_buttonDiv a{width:21px;height:15px !important;height:17px;float:right;padding-top:5px;color:#fff;font-family:Arial, Helvetica, sans-serif;font-size:10px;text-align:center;display:block;overflow:hidden;text-decoration:none;position:absolute;}
#f_buttonDiv a:link,#f_buttonDiv a:visited,#f_buttonDiv a:active{color:#000;}
#f_buttonDiv a:hover{background:#FF840C;color:#fff;}
#f_buttonDiv a.on:link,#f_buttonDiv a.on:visited,#f_buttonDiv a.on:active,#f_buttonDiv a.on:hover{background:#FF840C;color:#fff;}
#f_buttonDiv a.on:hover{background:#FF6600;}
#f_text{height:20px; line-height:20px; overflow:hidden;text-align:center;}
#f_text a:link,#f_text a:visited,#f_text a:active{color:#000;text-decoration: none;}
#f_text a:hover{color:#FF6600;text-decoration: none;}
-->
</style></head>
<body>
<div id="ad_pic">
<div id="f_div">
<!--图片区域-->
<div id="f_imgDiv"></div>
<div id="f_infoDiv">
<!--数字按钮区域-->
<div id="f_buttonDiv"></div>
</div>
</div>
<table width="150" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td align="center" bgcolor="#EFEFEF">
<!--焦点文字区域-->
<div id="f_text" class="f12b"></div>
<script language="javascript" type="text/javascript">
<!--
//more javascript from http://www.smallrain.netfunction p$(string){
document.write(string);
}
function $(id){
return document.getElementById(id);
}
function change_menu(id,content_id,num,total_ztc_menu,menu_on,menu_off){
for (var i=1;i<=total_ztc_menu;i++){
$(id+i).className=menu_off;
$(content_id+i).style.display='none';
}
$(id+num).className=menu_on;
$(content_id+num).style.display='block';
}
//可修改区域
var imgWidth=150;
var imgHeight=100;
var _timeOut_=5000;
var show_text = true; //是否显示焦点文字
var timeOut=_timeOut_;
var timeOut2=_timeOut_/2;//onmouseout img后需要切换的时间
var now=0; //第一张图
var target="_blank"; //打开方式
var button_on ='on'; //当前焦点对应按钮的样式名
var button_off ='';//非当前焦点对应按钮的样式名//不可修改区域
var imgUrl = new Array();
var imgText = new Array();
var imgLink = new Array();
var imgAlt= new Array();
var menuList = new Array();//菜单menu
var ver=2; //兼容浏览器版本 默认2 为非ie
var firstTime=true;
var n =-1;
//菜单menu
menuList[++n]='XX';
imgUrl[n]='http://www.smallrain.net/jsimg/1.jpg';
imgText[n]='<a href="#" target="_blank">内容一</a>';
imgLink[n]='http://www.smallrain.net';
imgAlt[n]='内容一';//菜单menu
menuList[++n]='XX';
imgUrl[n]='http://www.smallrain.net/jsimg/2.jpg';
imgText[n]='<a href="#" target="_blank">内容二</a>';
imgLink[n]='http://www.smallrain.net';
imgAlt[n]='内容二';//菜单menu
menuList[++n]='XX';
imgUrl[n]='http://www.smallrain.net/jsimg/3.jpg';
imgText[n]='<a href="#" target="_blank">内容三</a>';
imgLink[n]='http://www.smallrain.net';
imgAlt[n]='内容三';//菜单menu
menuList[++n]='XX';
imgUrl[n]='http://www.smallrain.net/jsimg/4.jpg';
imgText[n]='<a href="#" target="_blank">内容四</a>';
imgLink[n]='http://www.smallrain.net';
imgAlt[n]='内容四';
var count=0;
for (var i=0;i<imgUrl.length;i++) {
if( (imgUrl[i]!="") && (imgText[i]!="")&& (imgLink[i]!="")&& (imgAlt[i]!="")) {
count++;
} else {
break;
}
}
//重写css
var each_width=Math.ceil((imgWidth-(count-1))/count);
var last_width=imgWidth-each_width*(count-1)-(count)+1;function change(){
if (ver==1){
with($('f_img').filters[0]){
Transition=1;
apply();
play();
}
}
if (firstTime){ firstTime=false;timeOut=_timeOut_/1000;}
else{
$('f_img').src=imgUrl[now];
$('f_img').alt=imgAlt[now];
$('f_imgLink').href=imgLink[now];
if (show_text) $('f_text').innerHTML=imgText[now];
for (var i=0;i<count;i++) {
$('b'+i).className="button";
//$('f_menu'+i).className="";
}
$('b'+now).className="on";
//$('f_menu'+now).className="on";
now=(now>=imgUrl.length-1)?0:now+1;
timeOut=_timeOut_;
}
theTimer=setTimeout("change()", timeOut);
}
function b_change(num){
window.clearInterval(theTimer);
now=num;
firstTime=false;
change();
}
//draw 渐变line (即css:f_line)
function draw_line(){
var div = document.createElement("div");
div.id = 'f_line';
$('f_infoDiv').insertBefore(div,$('f_infoDiv').childNodes.item(0));
}
//表现层 start
//图片
var a = document.createElement("a");
a.id="f_imgLink";
a.target=target;
a.href=imgLink[now];
$('f_imgDiv').appendChild(a);var img = document.createElement("img");
img.id="f_img";
img.width=imgWidth;
img.height=imgHeight;
img.src=imgUrl[now];
img.alt=imgAlt[now];
a.appendChild(img);//数字按钮
for (var i=count-1;i>=0;i--){
var div_bg = document.createElement("div");
div_bg.id = 'div_bg'+i;
div_bg.className='bg';
$('f_buttonDiv').appendChild(div_bg);
var a = document.createElement("a");
a.id = 'b'+i;
a.className = (i==now+1)?"button_on":"button_off";
a.title=imgAlt[i];
a.innerHTML=i+1;
a.href='javascript:b_change('+i+')';
$('div_bg'+i).appendChild(a);
var div= document.createElement("div");
$('f_buttonDiv').appendChild(div);
}
if (show_text) $('f_text').innerHTML = imgText[now];
//表现层 end
$('f_img').onmouseover=function(){window.clearInterval(theTimer);}
$('f_img').onmouseout=function(){theTimer=setTimeout("change()", timeOut2);}
try{ //滤镜版本
new ActiveXObject("DXImageTransform.Microsoft.Fade");
$('f_img').filters[0].play();
ver=1;
draw_line();
}
catch (e){ver=2;}
var theTimer = setTimeout("change()", _timeOut_/1000);
//-->
</script>
</td>
</tr>
</table> </div>
</body>
</html>
我想让这段代码显示我在c盘下的1.gif,2.gif.3.gif,.4.gif这四个图象,我简单的把imgUrl[n]='http://www.smallrain.net/jsimg/4.jpg';改成imgUrl[n]='C:\0001.gif';这样子还是不可显示,很郁闷,请高手出手帮忙一下
<html>
<head><style type="text/css">
<!--
#f_div{width:150px; height:100px; margin:0 auto; overflow:hidden;}
#f_imgDiv{width:100%; height:100px; overflow:hidden;}
#f_img{filter:progid:DXImageTransform.Microsoft.Fade(Overlap=1.00); border:0;}
#f_infoDiv{width:100%;top:-20px !important;top:-22px; position:relative;}
#f_buttonDiv{width:100%; margin-right:1px; height:21px; overflow:hidden; text-align:left;}
#f_line{width:100%;height:1px;background:#fff; overflow:hidden;filter:progid:DXImageTransform.Microsoft.Alpha(startX=0, startY=0, finishX=50, finishY=100,style=1,opacity=0,finishOpacity=100)}
#f_buttonDiv div{width:1px;height:21px; background:#fff; float:right;}
#f_buttonDiv .bg{width:21px; height:21px; background:#fff; float:right; filter:Alpha(Opacity=40);}
#f_buttonDiv a{width:21px;height:15px !important;height:17px;float:right;padding-top:5px;color:#fff;font-family:Arial, Helvetica, sans-serif;font-size:10px;text-align:center;display:block;overflow:hidden;text-decoration:none;position:absolute;}
#f_buttonDiv a:link,#f_buttonDiv a:visited,#f_buttonDiv a:active{color:#000;}
#f_buttonDiv a:hover{background:#FF840C;color:#fff;}
#f_buttonDiv a.on:link,#f_buttonDiv a.on:visited,#f_buttonDiv a.on:active,#f_buttonDiv a.on:hover{background:#FF840C;color:#fff;}
#f_buttonDiv a.on:hover{background:#FF6600;}
#f_text{height:20px; line-height:20px; overflow:hidden;text-align:center;}
#f_text a:link,#f_text a:visited,#f_text a:active{color:#000;text-decoration: none;}
#f_text a:hover{color:#FF6600;text-decoration: none;}
-->
</style></head>
<body>
<div id="ad_pic">
<div id="f_div">
<!--图片区域-->
<div id="f_imgDiv"></div>
<div id="f_infoDiv">
<!--数字按钮区域-->
<div id="f_buttonDiv"></div>
</div>
</div>
<table width="150" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td align="center" bgcolor="#EFEFEF">
<!--焦点文字区域-->
<div id="f_text" class="f12b"></div>
<script language="javascript" type="text/javascript">
<!--
//more javascript from http://www.smallrain.netfunction p$(string){
document.write(string);
}
function $(id){
return document.getElementById(id);
}
function change_menu(id,content_id,num,total_ztc_menu,menu_on,menu_off){
for (var i=1;i<=total_ztc_menu;i++){
$(id+i).className=menu_off;
$(content_id+i).style.display='none';
}
$(id+num).className=menu_on;
$(content_id+num).style.display='block';
}
//可修改区域
var imgWidth=150;
var imgHeight=100;
var _timeOut_=5000;
var show_text = true; //是否显示焦点文字
var timeOut=_timeOut_;
var timeOut2=_timeOut_/2;//onmouseout img后需要切换的时间
var now=0; //第一张图
var target="_blank"; //打开方式
var button_on ='on'; //当前焦点对应按钮的样式名
var button_off ='';//非当前焦点对应按钮的样式名//不可修改区域
var imgUrl = new Array();
var imgText = new Array();
var imgLink = new Array();
var imgAlt= new Array();
var menuList = new Array();//菜单menu
var ver=2; //兼容浏览器版本 默认2 为非ie
var firstTime=true;
var n =-1;
//菜单menu
menuList[++n]='XX';
imgUrl[n]='http://www.smallrain.net/jsimg/1.jpg';
imgText[n]='<a href="#" target="_blank">内容一</a>';
imgLink[n]='http://www.smallrain.net';
imgAlt[n]='内容一';//菜单menu
menuList[++n]='XX';
imgUrl[n]='http://www.smallrain.net/jsimg/2.jpg';
imgText[n]='<a href="#" target="_blank">内容二</a>';
imgLink[n]='http://www.smallrain.net';
imgAlt[n]='内容二';//菜单menu
menuList[++n]='XX';
imgUrl[n]='http://www.smallrain.net/jsimg/3.jpg';
imgText[n]='<a href="#" target="_blank">内容三</a>';
imgLink[n]='http://www.smallrain.net';
imgAlt[n]='内容三';//菜单menu
menuList[++n]='XX';
imgUrl[n]='http://www.smallrain.net/jsimg/4.jpg';
imgText[n]='<a href="#" target="_blank">内容四</a>';
imgLink[n]='http://www.smallrain.net';
imgAlt[n]='内容四';
var count=0;
for (var i=0;i<imgUrl.length;i++) {
if( (imgUrl[i]!="") && (imgText[i]!="")&& (imgLink[i]!="")&& (imgAlt[i]!="")) {
count++;
} else {
break;
}
}
//重写css
var each_width=Math.ceil((imgWidth-(count-1))/count);
var last_width=imgWidth-each_width*(count-1)-(count)+1;function change(){
if (ver==1){
with($('f_img').filters[0]){
Transition=1;
apply();
play();
}
}
if (firstTime){ firstTime=false;timeOut=_timeOut_/1000;}
else{
$('f_img').src=imgUrl[now];
$('f_img').alt=imgAlt[now];
$('f_imgLink').href=imgLink[now];
if (show_text) $('f_text').innerHTML=imgText[now];
for (var i=0;i<count;i++) {
$('b'+i).className="button";
//$('f_menu'+i).className="";
}
$('b'+now).className="on";
//$('f_menu'+now).className="on";
now=(now>=imgUrl.length-1)?0:now+1;
timeOut=_timeOut_;
}
theTimer=setTimeout("change()", timeOut);
}
function b_change(num){
window.clearInterval(theTimer);
now=num;
firstTime=false;
change();
}
//draw 渐变line (即css:f_line)
function draw_line(){
var div = document.createElement("div");
div.id = 'f_line';
$('f_infoDiv').insertBefore(div,$('f_infoDiv').childNodes.item(0));
}
//表现层 start
//图片
var a = document.createElement("a");
a.id="f_imgLink";
a.target=target;
a.href=imgLink[now];
$('f_imgDiv').appendChild(a);var img = document.createElement("img");
img.id="f_img";
img.width=imgWidth;
img.height=imgHeight;
img.src=imgUrl[now];
img.alt=imgAlt[now];
a.appendChild(img);//数字按钮
for (var i=count-1;i>=0;i--){
var div_bg = document.createElement("div");
div_bg.id = 'div_bg'+i;
div_bg.className='bg';
$('f_buttonDiv').appendChild(div_bg);
var a = document.createElement("a");
a.id = 'b'+i;
a.className = (i==now+1)?"button_on":"button_off";
a.title=imgAlt[i];
a.innerHTML=i+1;
a.href='javascript:b_change('+i+')';
$('div_bg'+i).appendChild(a);
var div= document.createElement("div");
$('f_buttonDiv').appendChild(div);
}
if (show_text) $('f_text').innerHTML = imgText[now];
//表现层 end
$('f_img').onmouseover=function(){window.clearInterval(theTimer);}
$('f_img').onmouseout=function(){theTimer=setTimeout("change()", timeOut2);}
try{ //滤镜版本
new ActiveXObject("DXImageTransform.Microsoft.Fade");
$('f_img').filters[0].play();
ver=1;
draw_line();
}
catch (e){ver=2;}
var theTimer = setTimeout("change()", _timeOut_/1000);
//-->
</script>
</td>
</tr>
</table> </div>
</body>
</html>
我想让这段代码显示我在c盘下的1.gif,2.gif.3.gif,.4.gif这四个图象,我简单的把imgUrl[n]='http://www.smallrain.net/jsimg/4.jpg';改成imgUrl[n]='C:\0001.gif';这样子还是不可显示,很郁闷,请高手出手帮忙一下
#flash_img {
filter: revealtrans(duration=2.0,transition=12); width: 100%;
}
</style>
<table border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td id="flash_show_ctl_0" onClick="showImage(0);">1</td>
<td id="flash_show_ctl_1" onClick="showImage(1);">2</td>
<td id="flash_show_ctl_2" onClick="showImage(2);">3</td>
<td id="flash_show_ctl_3" onClick="showImage(3);">4</td>
<td id="flash_show_ctl_4" onClick="showImage(4);">5</td>
</tr>
</table>
<div id="flash_img" style="width:334px; height:167px;"></div><script language="javascript">
<!--
////////////////begin
var showImageIndex = -1;
var imageTimer = null;
function showImage(imageIndex)
{
var flash_img_div = document.getElementById("flash_img");
if(imageIndex>=fImgs.length){
imageIndex = 0;
}
if(!fImgs[imageIndex] || imageIndex==showImageIndex)return false;
var imgId = "__fImg"+imageIndex;
flash_img_div.filters && flash_img_div.filters[0].Apply();
for(var i=0; i<flash_img_div.childNodes.length; i++){
flash_img_div.removeChild(flash_img_div.childNodes[i]);
}
for(var i=0; i<fImgs.length;i++){
if(i == imageIndex)continue;
document.getElementById("flash_show_ctl_" + i).className = "focus-ctl";
}
document.getElementById("flash_show_ctl_" + imageIndex).className = "focus-ctl-nows";
var pos = fImgs[imageIndex].img.lastIndexOf(".");
if( fImgs[imageIndex].img.substr(pos+1).substr(0,3).toLowerCase()=="swf" ){
flash_img_div.innerHTML += '\
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="334" height="167" id="'+imgId+'">\
<param name="movie" value="'+fImgs[imageIndex].img+'" />\
<param name="quality" value="high" />\
<param name="wmode" value="transparent">\
<param name="scale" value="exactfit">\
<embed src="'+fImgs[imageIndex].img+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="334" height="167"></embed>\
</object>';
}else{
var img = new Image();
img.border = "0";
img.src = fImgs[imageIndex].img;
img.width = "334";
img.height = "167";
var a = document.createElement("a");
a.href = fImgs[imageIndex].href;
a.title = fImgs[imageIndex].title;
a.target = "_blank";
a.id = imgId;
a.appendChild(img);
flash_img_div.appendChild(a);
}
flash_img_div.filters && flash_img_div.filters[0].Play();
showImageIndex = imageIndex;
return true;
}
function imagePlay()
{
if(imageTimer) return;
if(showImageIndex>=fImgs.length){
showImageIndex = -1;
}
showImage(showImageIndex+1);
imageTimer = setInterval(function(){
var stat = showImage(showImageIndex+1);
if(!stat){
imageStop();
}
},8000);
}
function imageStop(){
if(imageTimer)clearInterval(imageTimer);
imageTimer = null;
}
function showNextImage(){
showImage(showImageIndex+1);
}
function showPrevImage(){
showImage(showImageIndex-1);
}var fImgs = new Array();
fImgs[0] = {title:"",img:"upload/images/subject/2007-02-06/1174915891_outline.jpg",href:"news.php?id=220"};
fImgs[1] = {title:"",img:"upload/images/subject/2007-02-06/1175244094_outline.jpg",href:"news.php?id=212"};
fImgs[2] = {title:"",img:"upload/images/subject/2007-02-06/1177150583_outline.jpg",href:"news.php?id=219"};
fImgs[3] = {title:"",img:"upload/images/subject/2007-02-06/1175897263_outline.jpg",href:"news.php?id=217"};
fImgs[4] = {title:"",img:"upload/images/subject/2007-02-06/1177509461_outline.jpg",href:"news.php?id=213"};
////////////////endwindow.document.body.onload = new function(){
imagePlay();//焦点图文
}
//-->
</script>