html 图片自动播放代码
3个回答
展开全部
你先试试这个代码(先用背景颜色来代码替):
<html>
<head>
</head>
<body>
<div id="div1" style="width:100px; height:100px; background:red;">
</div>
<script>
var adiv=document.getElementById('div1');
var colors=['green','black','pink','blue','yellow','gray','red'];
var i=0;
setInterval(function()
{
if(i==colors.length)
{
i=0;
}
adiv.style.backgroundColor=colors[i];
i++;
},1000)
</script>
</body>
</html>
看能不能帮上什么。
<html>
<head>
</head>
<body>
<div id="div1" style="width:100px; height:100px; background:red;">
</div>
<script>
var adiv=document.getElementById('div1');
var colors=['green','black','pink','blue','yellow','gray','red'];
var i=0;
setInterval(function()
{
if(i==colors.length)
{
i=0;
}
adiv.style.backgroundColor=colors[i];
i++;
},1000)
</script>
</body>
</html>
看能不能帮上什么。
博思aippt
2024-07-20 广告
2024-07-20 广告
博思AIPPT是基于ai制作PPT的智能在线工具,它提供了4种AI制作PPT的方式,包括AI生成大纲、AI直接生成PPT、文本生成PPT、AI提炼文档生成PPT,一站式集成多种AI生成PPT的方式,可满足办公用户的不同需求和使用场景。ai生...
点击进入详情页
本回答由博思aippt提供
展开全部
直接打开wow网站,然后“网页另存为”文件,直接保存下来,然后打开下载的html文件,找到图片切换的那一团,然后就copy了撒,找到相关的调用代码一并拷走就行了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2012-06-17
展开全部
<STYLE type=text/css>
/* 数字按钮框样式 */
#imgTitle {FILTER:ALPHA(opacity=70);position:relative;left:0px;text-align:left;overflow: hidden;}
#imgTitle_up {left:0px;text-align: left; height:1px; width:inherit; }
#imgTitle_down {left:0px;text-align: right; width:inherit; }
/* 图片框样式 */
.imgClass {border: 0px solid #000;}
/* 图片文字框样式 */
#txtFrom {text-align: center;vertical-align: middle; color:#333333}
/* 数字按钮样式 */
.button {text-decoration: none; float:left; height:12px; line-height:12px; padding-left:7px; padding-right:6px;background: #7B7B63;margin: 0px;font: bold 9px sans-serif; border-left:#fff 1px solid;}
a.button, a.button:link, a.button:visited {font-family: sans-serif;text-decoration: none;color:#FFFFFF;background-color: #000000;}
a.button:hover {font-family: sans-serif;text-decoration: none;color:#fff;background:#fff; }
.buttonDiv {background: #000000;height: 1px;width: 21px;float: left;text-align: center; vertical-align: middle;}
/*渐变*/
.trans { width:88px; height:12px; overflow:hidden}
</STYLE>
<SCRIPT language=JavaScript type=text/javascript>
var imgWidth=980; //图片宽
var imgHeight=280; //图片高
var textFromHeight=21; //焦点字框高度 (单位为px)
var textStyle="bt_link"; //焦点字class style (不是连接class)
var textLinkStyle="FONT"; //焦点字连接class style
var buttonLineOn="#ce0609"; //button下划线on的颜色
var buttonLineOff="#000"; //button下划线off的颜色
var TimeOut=5000; //每张图切换时间 (单位毫秒);
var imgUrl=new Array();
var imgLink=new Array();
var imgtext=new Array();
var imgAlt=new Array();
var adNum=0;
var theTimer=0;
var tt=1;
//焦点字框高度样式表 开始
document.write('<style type="text/css">');
document.write('#focuseFrom{width:'+(imgWidth+2)+';margin: 0px; padding:0px;height:'+(imgHeight+textFromHeight)+'px; overflow:hidden;}');
document.write('#txtFrom{height:'+textFromHeight+'px;line-height:'+textFromHeight+'px;width:'+imgWidth+'px;overflow:hidden;}');
document.write('#imgTitle{width:'+imgWidth+';top:-'+(textFromHeight+12)+'px;height:18px}');
document.write('</style>');
document.write('<div id="focuseFrom">');
//焦点字框高度样式表 结束
tt=1;
imgUrl[tt] ='8.jpg';
imgtext[tt]=' meiyou';
imgLink[tt]='a.asp';
imgAlt[tt]='预测';
tt=2;
imgUrl[tt] ='12.jpg';
imgtext[tt]=' 术';
imgLink[tt]='a.asp';
imgAlt[tt]='艺术';
tt=3;
imgUrl[tt] ='8.jpg';
imgtext[tt]=' 的说法义';
imgLink[tt]='a.asp';
imgAlt[tt]='羊的说法主义';
tt=4;
imgUrl[tt] ='12.jpg';
imgtext[tt]=' 07/是地方就衫';
imgLink[tt]='a.asp';
imgAlt[tt]='羊的说法义';
var intPage =0;
for (var i=1;i<=imgUrl.length;i++)
{
if (imgUrl[i]!="!!!")
{
intPage++;
}
}
function changeimg(n)
{
adNum=n;
window.clearInterval(theTimer);
adNum=adNum-1;
nextAd();
}
function goUrl(){
window.open(imgLink[adNum],'_blank');
}
//NetScape开始
if (navigator.appName == "Netscape")
{
document.write('<style type="text/css">');
document.write('.buttonDiv{height:4px;width:21px;}');
document.write('</style>');
function nextAd(){
if(adNum<(intPage-1))adNum++;
else adNum=1;
theTimer=setTimeout("nextAd()", TimeOut);
document.images.imgInit.src=imgUrl[adNum];
document.images.imgInit.alt=imgAlt[adNum];
document.getElementById('focustext').innerHTML=imgtext[adNum];
document.getElementById('link'+adNum).style.background=buttonLineOn;
document.getElementById('imgLink').href=imgLink[adNum];
for (var i=1;i<=intPage;i++)
{
if (i!=adNum){document.getElementById('link'+i).style.background=buttonLineOff;}
}
}
document.write('<a id="imgLink" href="'+imgLink[1]+'" target=_blank class="p1"><img src="imgUrl[1]" name="imgInit" border=1 alt="'+imgAlt[1]+'" class="imgClass"></a><div id="txtFrom"><span id="focustext" class="'+textStyle+'">'+imgtext[1]+'</span></div>')
document.write('<div id="imgTitle">');
document.write('<div id="imgTitle_down">');
//数字按钮代码开始
for(var i=1;i<intPage;i++){document.write('<a href="javascript:changeimg('+i+')" class="button" style="cursor:hand" title="'+imgAlt[i]+'">'+i+'</a>');}
//数字按钮代码结束
document.write('</div>');
document.write('</div>');
document.write('</div>');
nextAd();
}
//NetScape结束
//IE开始
else
{
var count=0;
for (i=1;i<intPage;i++) {
if( (imgUrl[i]!="") && (imgLink[i]!="")&&(imgtext[i]!="")&&(imgAlt[i]!="") ) {
count++;
} else {
break;
}
}
function playTran(){
if (document.all)
document.images.imgInit.filters.BlendTrans.play();
}
var key=0;
function nextAd(){
if(adNum<count)adNum++ ;
else adNum=1;
if( key==0 ){
key=1;
} else if (document.all){
//imgInit.filters.revealTrans.Transition=6;
document.images.imgInit.filters.BlendTrans.apply();
playTran();
}
document.images.imgInit.src= imgUrl[adNum];
document.images.imgInit.alt=imgAlt[adNum];
document.getElementById('link'+adNum).style.background=buttonLineOn;
for (var i=1;i<=count;i++)
{
if (i!=adNum){document.getElementById('link'+i).style.background=buttonLineOff;}
}
focustext.innerHTML=imgtext[adNum];
//links_ie_font.links=imglink[adNum];
theTimer=setTimeout("nextAd()", TimeOut);
}
document.write('<a target=_self href="javascript:goUrl()"><img style="FILTER: BlendTrans ( duration=1 );" src="javascript:nextAd()" border=0 vspace="0" name=imgInit class="imgClass"></a>');
document.write('<div id="txtFrom"><a target=_self href="javascript:goUrl()"><span id="focustext" class="'+textStyle+'"></span></a></div>');
document.write('<div id="imgTitle">');
document.write(' <div id="imgTitle_down"> <a class="trans"" style="float:left"><img src=" 20070726/20070726203802_3.gif" border=0></a>');
//数字按钮代码开始
for(var i=1;i<intPage;i++){document.write('<a id="link'+i+'" href="javascript:changeimg('+i+')" class="button" style="cursor:hand" title="'+imgAlt[i]+'" onFocus="this.blur()">'+i+'</a>');}
//数字按钮代码结束
document.write('</div>');
document.write('</div>');
document.write('</div>');
changeimg(1);
}
//IE结束
</SCRIPT>
/* 数字按钮框样式 */
#imgTitle {FILTER:ALPHA(opacity=70);position:relative;left:0px;text-align:left;overflow: hidden;}
#imgTitle_up {left:0px;text-align: left; height:1px; width:inherit; }
#imgTitle_down {left:0px;text-align: right; width:inherit; }
/* 图片框样式 */
.imgClass {border: 0px solid #000;}
/* 图片文字框样式 */
#txtFrom {text-align: center;vertical-align: middle; color:#333333}
/* 数字按钮样式 */
.button {text-decoration: none; float:left; height:12px; line-height:12px; padding-left:7px; padding-right:6px;background: #7B7B63;margin: 0px;font: bold 9px sans-serif; border-left:#fff 1px solid;}
a.button, a.button:link, a.button:visited {font-family: sans-serif;text-decoration: none;color:#FFFFFF;background-color: #000000;}
a.button:hover {font-family: sans-serif;text-decoration: none;color:#fff;background:#fff; }
.buttonDiv {background: #000000;height: 1px;width: 21px;float: left;text-align: center; vertical-align: middle;}
/*渐变*/
.trans { width:88px; height:12px; overflow:hidden}
</STYLE>
<SCRIPT language=JavaScript type=text/javascript>
var imgWidth=980; //图片宽
var imgHeight=280; //图片高
var textFromHeight=21; //焦点字框高度 (单位为px)
var textStyle="bt_link"; //焦点字class style (不是连接class)
var textLinkStyle="FONT"; //焦点字连接class style
var buttonLineOn="#ce0609"; //button下划线on的颜色
var buttonLineOff="#000"; //button下划线off的颜色
var TimeOut=5000; //每张图切换时间 (单位毫秒);
var imgUrl=new Array();
var imgLink=new Array();
var imgtext=new Array();
var imgAlt=new Array();
var adNum=0;
var theTimer=0;
var tt=1;
//焦点字框高度样式表 开始
document.write('<style type="text/css">');
document.write('#focuseFrom{width:'+(imgWidth+2)+';margin: 0px; padding:0px;height:'+(imgHeight+textFromHeight)+'px; overflow:hidden;}');
document.write('#txtFrom{height:'+textFromHeight+'px;line-height:'+textFromHeight+'px;width:'+imgWidth+'px;overflow:hidden;}');
document.write('#imgTitle{width:'+imgWidth+';top:-'+(textFromHeight+12)+'px;height:18px}');
document.write('</style>');
document.write('<div id="focuseFrom">');
//焦点字框高度样式表 结束
tt=1;
imgUrl[tt] ='8.jpg';
imgtext[tt]=' meiyou';
imgLink[tt]='a.asp';
imgAlt[tt]='预测';
tt=2;
imgUrl[tt] ='12.jpg';
imgtext[tt]=' 术';
imgLink[tt]='a.asp';
imgAlt[tt]='艺术';
tt=3;
imgUrl[tt] ='8.jpg';
imgtext[tt]=' 的说法义';
imgLink[tt]='a.asp';
imgAlt[tt]='羊的说法主义';
tt=4;
imgUrl[tt] ='12.jpg';
imgtext[tt]=' 07/是地方就衫';
imgLink[tt]='a.asp';
imgAlt[tt]='羊的说法义';
var intPage =0;
for (var i=1;i<=imgUrl.length;i++)
{
if (imgUrl[i]!="!!!")
{
intPage++;
}
}
function changeimg(n)
{
adNum=n;
window.clearInterval(theTimer);
adNum=adNum-1;
nextAd();
}
function goUrl(){
window.open(imgLink[adNum],'_blank');
}
//NetScape开始
if (navigator.appName == "Netscape")
{
document.write('<style type="text/css">');
document.write('.buttonDiv{height:4px;width:21px;}');
document.write('</style>');
function nextAd(){
if(adNum<(intPage-1))adNum++;
else adNum=1;
theTimer=setTimeout("nextAd()", TimeOut);
document.images.imgInit.src=imgUrl[adNum];
document.images.imgInit.alt=imgAlt[adNum];
document.getElementById('focustext').innerHTML=imgtext[adNum];
document.getElementById('link'+adNum).style.background=buttonLineOn;
document.getElementById('imgLink').href=imgLink[adNum];
for (var i=1;i<=intPage;i++)
{
if (i!=adNum){document.getElementById('link'+i).style.background=buttonLineOff;}
}
}
document.write('<a id="imgLink" href="'+imgLink[1]+'" target=_blank class="p1"><img src="imgUrl[1]" name="imgInit" border=1 alt="'+imgAlt[1]+'" class="imgClass"></a><div id="txtFrom"><span id="focustext" class="'+textStyle+'">'+imgtext[1]+'</span></div>')
document.write('<div id="imgTitle">');
document.write('<div id="imgTitle_down">');
//数字按钮代码开始
for(var i=1;i<intPage;i++){document.write('<a href="javascript:changeimg('+i+')" class="button" style="cursor:hand" title="'+imgAlt[i]+'">'+i+'</a>');}
//数字按钮代码结束
document.write('</div>');
document.write('</div>');
document.write('</div>');
nextAd();
}
//NetScape结束
//IE开始
else
{
var count=0;
for (i=1;i<intPage;i++) {
if( (imgUrl[i]!="") && (imgLink[i]!="")&&(imgtext[i]!="")&&(imgAlt[i]!="") ) {
count++;
} else {
break;
}
}
function playTran(){
if (document.all)
document.images.imgInit.filters.BlendTrans.play();
}
var key=0;
function nextAd(){
if(adNum<count)adNum++ ;
else adNum=1;
if( key==0 ){
key=1;
} else if (document.all){
//imgInit.filters.revealTrans.Transition=6;
document.images.imgInit.filters.BlendTrans.apply();
playTran();
}
document.images.imgInit.src= imgUrl[adNum];
document.images.imgInit.alt=imgAlt[adNum];
document.getElementById('link'+adNum).style.background=buttonLineOn;
for (var i=1;i<=count;i++)
{
if (i!=adNum){document.getElementById('link'+i).style.background=buttonLineOff;}
}
focustext.innerHTML=imgtext[adNum];
//links_ie_font.links=imglink[adNum];
theTimer=setTimeout("nextAd()", TimeOut);
}
document.write('<a target=_self href="javascript:goUrl()"><img style="FILTER: BlendTrans ( duration=1 );" src="javascript:nextAd()" border=0 vspace="0" name=imgInit class="imgClass"></a>');
document.write('<div id="txtFrom"><a target=_self href="javascript:goUrl()"><span id="focustext" class="'+textStyle+'"></span></a></div>');
document.write('<div id="imgTitle">');
document.write(' <div id="imgTitle_down"> <a class="trans"" style="float:left"><img src=" 20070726/20070726203802_3.gif" border=0></a>');
//数字按钮代码开始
for(var i=1;i<intPage;i++){document.write('<a id="link'+i+'" href="javascript:changeimg('+i+')" class="button" style="cursor:hand" title="'+imgAlt[i]+'" onFocus="this.blur()">'+i+'</a>');}
//数字按钮代码结束
document.write('</div>');
document.write('</div>');
document.write('</div>');
changeimg(1);
}
//IE结束
</SCRIPT>
参考资料: 希望能帮上你
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询