图片左右轮换代码(切换图片代码)
admin 发布:2022-12-19 18:52 142
今天给各位分享图片左右轮换代码的知识,其中也会对切换图片代码进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
本文目录一览:
- 1、html代码中如何实现图片轮换效果?
- 2、JS特效 按钮实现图片左右轮换(总共4张图,img1.jpg,img2.jpg,img3.jpg,img4.jpg)
- 3、图片左右滚动代码
- 4、图片轮换代码解释
- 5、网页的图片轮换的代码是什么
- 6、让图片从右到左滚动的网页代码是怎么样的?
html代码中如何实现图片轮换效果?
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""
html xmlns=""
head
meta http-equiv="Content-Type" content="text/html; charset=gb2312" /
title图片滚动/title
/head
body
style type="text/css"
!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
width: 500px;
}
#demo img {
border: 3px solid #F2F2F2;
}
#indemo {
float: left;
width: 800%;
}
#demo1 {
float: left;
}
#demo2 {
float: left;
}
--
/style
div id="demo"
div id="indemo"
div id="demo1"
a href="#"img src="/jscss/demoimg/wall_s1.jpg" border="0" //a
a href="#"img src="/jscss/demoimg/wall_s2.jpg" border="0" //a
a href="#"img src="/jscss/demoimg/wall_s3.jpg" border="0" //a
a href="#"img src="/jscss/demoimg/wall_s4.jpg" border="0" //a
a href="#"img src="/jscss/demoimg/wall_s5.jpg" border="0" //a
a href="#"img src="/jscss/demoimg/wall_s6.jpg" border="0" //a
/div
div id="demo2"/div
/div
/div
script
!--
var speed=10;
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML;
function Marquee(){
if(tab2.offsetWidth-tab.scrollLeft=0)
tab.scrollLeft-=tab1.offsetWidth
else{
tab.scrollLeft++;
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
--
/script
/body
/html
JS特效 按钮实现图片左右轮换(总共4张图,img1.jpg,img2.jpg,img3.jpg,img4.jpg)
var picID = 0;//换成网页中那幅图在picURL中的序号(记得要从0开始数)
var picURL = ["images/img1.jpg","images/img2.jpg","images/img3.jpg"];//将图片链接地址放进来,数量随意
function showimg(str){
if(str=="L"){
if(picID==0){
picID = picURL.length-1;
document.getElementById("advimg").src = picURL[picID];
}else{
document.getElementById("advimg").src = picURL[--picID];
}
}else if(str=="R"){
if(picID==(picURL.length-1)){
picID = 0;
document.getElementById("advimg").src = picURL[picID];
}else{
document.getElementById("advimg").src = picURL[++picID];
}
}
}
图片左右滚动代码
div id="demo0" style="OVERFLOW: hidden; margin-top:2px; WIDTH:510Px; HEIGHT: 125px"
align="center"
!--滚动区的高度和宽度--
table cellspacing="0" cellpadding="0" align="center" bgcolor="#ffffff" border="0"
cellspace="0"
tbody
tr
td id="demo11" valign="middle"table cellspacing="0" cellpadding="2" width="100%" align="center" bgcolor="#ffffff" border="0"
tbody
tr valign="top" /tr
tr valign="middle"
td align="middle" class="tex2"a href="yjxxy.asp" img src="images/pi_32.gif" border="0" width="119" height="91" //a/td
td align="middle"class="tex2"/td
td align="middle"class="tex2"a href="yjxxy.asp" img src="images/pi_32.gif" border="0" width="119" height="91" //a/td
td align="middle"class="tex2"/td
td align="middle"class="tex2"a href="yjxxy.asp" img src="images/pi_32.gif" border="0" width="119" height="91" //a/td
td align="middle"class="tex2"/td
td align="middle"class="tex2"a href="yjxxy.asp" img src="images/pi_32.gif" border="0" width="119" height="91" //a/td
td align="middle"class="tex2"/td
td align="middle"class="tex2"a href="yjxxy.asp" img src="images/pi_32.gif" border="0" width="119" height="91" //a/td
td align="middle"class="tex2"/td
td align="middle"class="tex2"a href="yjxxy.asp" img src="images/pi_32.gif" border="0" width="119" height="91" //a/td
td align="middle"class="tex2"/td
/tr
tr valign="middle"
td align="center"欢迎光临怡女子博客空间/td
td align="center"/td
td align="center"欢迎光临怡女子博客空间/td
td align="center"/td
td align="center"欢迎光临怡女子博客空间/td
td align="center"/td
td align="center"欢迎光临怡女子博客空间/td
td align="center"/td
td align="center"欢迎光临怡女子博客空间/td
td align="center"/td
td align="center"欢迎光临怡女子博客空间/td
td align="middle"/td
/tr
/tbody
/table/td
td id="demo15" valign="top" /td
/tr
/tbody
/table
/div
script
var Picspeed=32
demo15.innerHTML=demo11.innerHTML
function Marquee1(){
if(demo15.offsetWidth-demo0.scrollLeft=0)
demo0.scrollLeft-=demo11.offsetWidth
else{
demo0.scrollLeft++
}
}
var MyMar1=setInterval(Marquee1,Picspeed)
demo0.onmouseover=function() {clearInterval(MyMar1)}
demo0.onmouseout=function() {MyMar1=setInterval(Marquee1,Picspeed)}
/script
/div
图片轮换代码解释
首先,document.write这个方法所输出的内容并不是纯文字,它可以识别HTML标签,XML敏感的方法。
里面的网址应该是flash播放器插件的获取地址
网页的图片轮换的代码是什么
div style="margin-left:15px; margin-top:10px; margin-right:10px; width:230px;"
style type="text/css"
!--
#imgTitle {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: 1px solid #EEEEEE;}
/* 图片文字框样式 */
#txtFrom {text-align: center;vertical-align: middle;}
/* 数字按钮样式 */
.button {text-decoration: none;padding: 1px 7px; line-height:10px; margin-right: 0px; font-size: 9px; font-weight: bold; border-left: 1px #fff solid; }
.button:link { text-decoration: none; color: #FFF; background: #000;}
.button:visited { text-decoration: none; color: #FFF; background: #000;}
.button:hover { text-decoration: none; color: #FFF; background: #F00; }
.button:active { text-decoration: none; color: #FFF; background: #000; }
.buttonDiv {margin: 0px;background: #000000;height: 1px;width: 21px;float: right;text-align: center;vertical-align: middle;}
--
/style
script language='javascript' type='text/javascript'
var imgWidth=230; //图片宽
var imgHeight=170; //图片高
var textFromHeight=20; //焦点字框高度 (单位为px)
var textStyle='fb'; //焦点字class style (不是连接class)
var textLinkStyle='p1'; //焦点字连接class style
var buttonLineOn='#F00'; //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;
//焦点字框高度样式表 开始
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+11)+'px; height: 18px}');
document.write('/style');
document.write('div id="focuseFrom"');
//焦点字框高度样式表 结束
imgUrl[1]='/images/content/2012/20120604154259198160.jpg';
imgtext[1]='a target="_blank" href="/zjzx/tpxw/54826.html"国家纺织检测重点实验室联盟总部落户无锡/a';
imgLink[1]='/zjzx/tpxw/54826.html';
imgAlt[1]='国家纺织检测重点实验室联盟总部落户无锡';
imgUrl[2]='/images/content/2012/20120601143224661455.jpg';
imgtext[2]='a target="_blank" href="/zjzx/tpxw/54780.html"保障质量安全 守望儿童幸福/a';
imgLink[2]='/zjzx/tpxw/54780.html';
imgAlt[2]='保障质量安全 守望儿童幸福';
imgUrl[3]='/images/content/2012/20120529093056858140.jpg';
imgtext[3]='a target="_blank" href="/zjzx/tpxw/54690.html"杭州检验检疫局有效防控外来有害生物入侵/a';
imgLink[3]='/zjzx/tpxw/54690.html';
imgAlt[3]='杭州检验检疫局有效防控外来有害生物入侵';
imgUrl[4]='/images/content/2012/20120529092955413952.jpg';
imgtext[4]='a target="_blank" href="/zjzx/tpxw/54689.html"宜兴检验检疫局确保茶叶出口质量安全/a';
imgLink[4]='/zjzx/tpxw/54689.html';
imgAlt[4]='宜兴检验检疫局确保茶叶出口质量安全';
function changeimg(n)
{
adNum=n;
window.clearInterval(theTimer);
adNum=adNum-1;
nextAd();
}
function goUrl()
{ window.open(imgLink[adNum]);
}
//NetScape开始
//if (navigator.appName == "Netscape")
//{
function nextAd()
{
if (adNum(imgUrl.length-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=imgUrl.length;i++)
{
if (i!=adNum){document.getElementById('link'+i).style.background=buttonLineOff;}
}
}
document.write('a id="imgLink" href="'+imgLink[4]+'" target=_blank class="linkwhite"img src="'+imgUrl[4]+'" name="imgInit" width='+imgWidth+' height='+imgHeight+' border=1 alt="'+imgAlt[4]+'" class="imgClass"/adiv id="txtFrom"span id="focustext" class="'+textStyle+'"'+imgtext[4]+'/span/div')
document.write('div id="imgTitle"');
document.write('div id="imgTitle_down"');
//数字按钮代码开始
for(var i=1;iimgUrl.length;i++){document.write('a id="link'+i+'" href="javascript:changeimg('+i+')" class="button" title="'+imgAlt[i]+'" onFocus="this.blur()" target=_self'+i+'/a');}
//数字按钮代码结束 document.write('/div');
document.write('/div');
document.write('/div');
nextAd();
/script /div
让图片从右到左滚动的网页代码是怎么样的?
往左是:
marqueeimg
src="你的图片地址"/marquee
往右是:
marquee
direction=rightimg
src="你的图片地址"/marquee
往上是:
marquee
direction=upimg
src="你的图片地址"/marquee
往下是:
marquee
direction=downimg
src="你的图片地址"/marquee
如果需要在当鼠标移动到图片上时停止滚动,就在marquee里加onmouseover=stop()
onmouseout=start(),
例如marquee
direction=down
onmouseover=stop()
onmouseout=start()img
src="你的图片地址"/marquee
关于图片左右轮换代码和切换图片代码的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。
版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;
相关推荐
- 05-09网页代码,网页代码快捷键
- 05-07广告切换源代码免费下载(广告切换源代码免费下载安装)[20240507更新]
- 05-06单页网站的代码(完整的网页代码)[20240506更新]
- 05-06个人主页图片代码(个人主页图片代码怎么弄)[20240506更新]
- 05-06提取微信名片代码(微信名片信息提取)[20240506更新]
- 05-06php后台权限管理代码(php管理员权限)[20240506更新]
- 05-06付费观看代码php(付费观看代码)[20240506更新]
- 05-06在线html执行代码(html怎么运行)[20240506更新]
- 05-06源代码管理资源管理器(资源管理器运行代码)[20240506更新]
- 05-06代码源软件库(程序代码库)[20240506更新]
取消回复欢迎 你 发表评论:
- 标签列表
- 最近发表
- 友情链接