Html网页图片滚动代码
var speed=30
butong_net_top2.innerHTML=butong_net_top1.innerHTML //克隆
butong_net_top1为butong_net_top2
function Marquee1(){
//当滚动至butong_net_top1与butong_net_top2交界时
if(butong_net_top2.offsetTop-butong_net_top.scrollTop<=0)&<60;&<60; butong_net_top.scrollTop-=butong_net_top1.offsetHeight
//butong_net_top跳到最顶端
else{
butong_net_top.scrollTop++;
}
}
var MyMar1=setInterval(Marquee1,speed)//设置定时器
//鼠标移上时清除定时器达到滚动停止的目的
butong_net_top.onmouseover=function() {clearInterval(MyMar1)}
//鼠标移开时重设定时器
butong_net_top.onmouseout=function(){MyMar1=setInterval(Marquee1,spee d)}
var speed=30
butong_net_bottom2.innerHTML=butong_net_bottom1.innerHTML
butong_net_bottom.scrollTop=butong_net_bottom.scrollHeight function Marquee2(){
if(butong_net_bottom1.offsetTop-butong_net_bottom.scrollTop>=0) butong_net_bottom.scrollTop+=butong_net_bottom2.offsetHeight else{
butong_net_bottom.scrollTop--
}
}
var MyMar2=setInterval(Marquee2,speed)
butong_net_bottom.onmouseover=function() {clearInterval(MyMar2)} butong_net_bottom.onmouseout=function()
{MyMar2=setInterval(Marquee2,speed)}
var speed=30//速度数值越大速度越慢
butong_net_left2.innerHTML=butong_net_left1.innerHTML
function Marquee3(){
if(butong_net_left2.offsetWidth-butong_net_left.scrollLeft<=0) butong_net_left.scrollLeft-=butong_net_left1.offsetWidth
else{
butong_net_left.scrollLeft++
}
}
var MyMar3=setInterval(Marquee3,speed)
butong_net_left.onmouseover=function() {clearInterval(MyMar3)} butong_net_left.onmouseout=function()
{MyMar3=setInterval(Marquee3,speed)}
var speed=30//速度数值越大速度越慢
butong_net_right2.innerHTML=butong_net_right1.innerHTML
function Marquee4(){
if(butong_net_right.scrollLeft<=0)
butong_net_right.scrollLeft+=butong_net_right2.offsetWidth
else{
butong_net_right.scrollLeft--
}
}
var MyMar4=setInterval(Marquee4,speed)
butong_net_right.onmouseover=function() {clearInterval(MyMar4)} butong_net_right.onmouseout=function()
{MyMar4=setInterval(Marquee4,speed)}
div实现向左右无缝滚动图片效果(跑马灯) div+css学习笔记22(用div实现向左无缝滚动图片效果)JavaScript实现走马灯效果[无缝连接、循环滚动] 无缝跑马灯效果以下代码在IE6、Firefox+Win2k环境下测试通过网页走马灯连续循环滚动废话少说,代码贴出来:<div id="imgmarquee" style="OVERFLOW: hidden; WIDTH: 580px; align: left; background-color:#0099CC;"> <div style="width:1200px"><!--id="marquePic1"里面的宽度一定要大于id="imgmarquee"的宽度才能看到效果 width:600px;>WIDTH: 580px;大的div宽度要为span的两倍才可以,不然会换行width:1200px zdz的作品,流风的作品--> <span id="marquePic1" style="width:600px; background-color:#990033;"> <img src="../images/dialog/4.gif" /> <img src="../images/dialog/4.gif" /> <img src="../images/dialog/4.gif" /> <img src="../images/dialog/4.gif" /> <img src="../images/dialog/4.gif" /> <img src="../images/dialog/4.gif" /> <img src="../images/dialog/4.gif" /> <img src="../images/dialog/4.gif" /> </span>
世界大学城 css代码添加背景图片常用代码 (2011-05-22 20:18:58) 转载 标签: 杂谈 1 背景颜色 {background-color:数值} 2 背景图片 {background-image: url(URL)|none} 3 背景重复 {background-repeat:inherit|no-repeat|repeat|repeat-x|repeat-y} 4 背景固定 {background-attachment:fixed|scroll} 5 背景定位 {background-position:数值|top|bottom|left|right|center} 6 背影样式 {background:背景颜色|背景图象|背景重复|背景附件|背景位置} 1.背景颜色:background-color 语法:{background-color:数值} 说明:参数取值和颜色属性一样 注意:在HTML当中,要为某个对象加上背景色只有一种办法,那就是先做一个表格,在表格中设置完背景色,再把对象放进单元格。这样做比较麻烦,不但代码较多,还要为表格的大小和定位伤些脑筋。现在用CSS就可以轻松地直接搞定了,而且对象的范围很广,可以是一段文字,也可以只是一个单词或一个字母。例子:给部分文字加背景颜色给部分文字加背景颜色 表格背影颜色:style="background-color:red" 2.背景图片:background-image 语法:{background-image: url(URL)|none} 说明: URL就是背景图片的存放路径。如果用“none”来代替背景图片的存放路径,将什么也不显示。 例子:给部分文字加背景图片 .imgbgstyle { background-image: url(logo.gif)} 3.背景重复:background-repeat 语法:{background-repeat:inherit|no-repeat|repeat|repeat-x|repeat-y} 作用:背景图片重复控制的是背景图片平铺与否,也就是说,结合背景定位的控制可以在网页上的某处单独显示一幅背景图片 说明:参数取值范围: ·inherit 继承 ·no-repeat 不重复平铺背景图片 ·repeat ·repeat-x 使图片只在水平方向上平铺 ·repeat-y 使图片只在垂直方向上平铺 注意:如果不指定背景图片重复属性,浏览器默认的是背景图片向水平、垂直两个方向上平铺。 4.背景固定:background-attachment
怎么在网页上制作滚动图片? 20 [ 标签:网页, 图片] 时光☆流年 2012-03-12 23:00 满意答案 /** * 文字上下滚动 * @param flag 标识是否滚动 * @param fatherMarqueeContentId 父容器 * @param firMarqueeContentId 子容器1 * @param secMarqueeContentId 子容器2 * @param timeSpan 滚动时间间隔默 认为100毫秒 */ var MarqueeObj = function(fatherMarqueeContentId,firMarqueeContentId,secMarqueeContent Id,timeSpan) { this.flag = 0; this.fatherMarqueeContentId = fatherMarqueeContentId; this.firMarqueeContentId = firMarqueeContentId; this.secMarqueeContentId = secMarqueeContentId; this.timeSpan = timeSpan || 100; //初始化,开启循环滚动 this.init = function() { initScrollContentHeight(this); //定时器 setInterval(marquee,this.timeSpan); this.bindMouseOver(); this.bindMouseOut(); } //开始 this.start = function() { this.flag = 0; } //停止 this.stop = function() { this.flag = 1; } var that = this; //滚动核心函数 var marquee = function() { if(that.flag == 1) { return; } if(document.getElementById(that.firMarqueeContentId).offsetHeight <= document.getElementById(that.fatherMarqueeContentId).scrollTop) { document.getElementById(that.fatherMarqueeContentId).scrollTop -= document.getElementById(that.firMarqueeContentId).offsetHeight; } else { document.getElementById(that.fatherMarqueeContentId).scrollTop ++; } } this.bindMouseOver = function() { document.getElementById(this.fatherMarqueeContentId).onmouseover = function() { that.stop(); } } this.bindMouseOut = function() { document.getElementById(this.fatherMarqueeContentId).onmouseout = function() { that.start(); } } /**初始化可滚动内容的高度 * 将可滚动内容的高度和父容器的高度比较,如果低于它, * 就将可滚动内容的高度置为父容器的高度 * @param obj 可滚动对象 */ var initScrollContentHeight = function(obj){ if(document.getElementById(obj.firMarqueeContentId). scrollHeight < document.getElementById(obj.fatherMarqueeContentId).offsetHeight){ document.getElementById(obj.firMarqueeContentId).style.height = document.getElementById(obj.fatherMarqueeContentId).offsetHeight + "px"; document.getElementById(obj.secMarqueeContentId).style.height = document.getElementById(obj.fatherMarqueeContentId).offsetHeight + "px"; }
[HTML代码]会移动的文字(Marquee) Marquee标记用于在可用浏览区域中滚动文本。这个标记只适用于 IE3以后的版的浏览器。 格式: 属性: ALIGN:用于按设定的值对齐滚动的文本。ALIGN可以设
定的值有:LEFT,CENTER,RIGHT,TOP,BOTTOM。此属性不 是必须使用的。 例: BEHAVIOR:可以在页面上一旦出现文本时让浏览器按照设定的方法来处理文本。如果设定的方法是SLIDE,那么文本就移动到文档上,并停留在页边距上。如果设定为ALTERNATE,则文本从一边移动到另一边。如果设定为SCROLL,文本将在页面上反复滚动。本属性不是必须使用的。可以设定的值有:SILIDE, ALTERNATE,SCROLL。 例: BGCOLOR:用于设定字幕的背景颜色。背景颜色可用 RGB、16进制值的格式或颜色名称来设定。 例:
[网站建设]网页中插入图片实现滚动代码
网页中的浮动图片代码 一、没有点击关闭的 等等标志对,这些标志对都是描述Html 文档相关信息的标志对,
标志对之间的内容是不会在浏览器的框内显示出来的。两个标志必须一块使用。 3. 是Html文档的主体部分,在此标志对之间可包含、< /p>、图片循环滚动代码(无缝滚动)(分别向上、下、左、右) 向上:程序代码
二、向下的无缝循环滚动 程序代码: [ 复制代码到剪贴板 ]
动态网页代码 图片无缝滚动代码