滚动公告的代码(网站公告滚动代码)
admin 发布:2022-12-19 21:12 143
本篇文章给大家谈谈滚动公告的代码,以及网站公告滚动代码对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:
网站滚动公告代码
=======================================================
第一种,使用JS控制(推荐),JS脚本必须放在公告代码之后
=======================================================
以下代码可直接放在html文档的body/body间:
style
.scrollTxt{width:200px;height:24px;overflow:hidden;font-size:14px;line-height:18px;}
.scrollTxt a{display:block;width:200px;float:left;height:24px;overflow:hidden;padding-left:12px;color:#ff4400}
.scrollTxt a:hover {COLOR: #00c;}
.scrollTxt p{overflow: hidden; height: 18px; line-height: 18px;}
/style
div class="scrollTxt"
p id="infan2010"
a href="http://" target="_blank"人民币创2010年汇率新高/abr
a href="http://" target="_blank"中国南方省退休年龄延长/abr
a href="http://" target="_blank"深圳市假公交案水落石出/abr
a href="http://" target="_blank"芙蓉姐姐征婚选百度知道/abr
a href="http://" target="_blank"中国明日向日本鬼子开炮/abr
/p
/div
script type="text/javascript"
(function() {
var pthis = this;
this.$ = function(a) {
if (document.getElementById) {
return eval('document.getElementById("' + a + '")')
} else {
if (document.layers) {
return eval("document.layers['" + a + "']")
} else {
return eval("document.all." + a)
}
}
};
this.SinaDotMarquee = function(id, h, s, d) {
var apthis = this;
var t;
var p = false;
var o = pthis.$(id);
o.style.overflow = "hidden";
o.style.height = h + "px";
o.style.lineHeight = h + "px";
o.innerHTML += o.innerHTML;
o.onmouseover = function() {
p = true
};
o.onmouseout = function() {
p = false
};
o.scrollTop = 0;
this.doScroll = function() {
try{
t = setInterval(apthis.scrolling, s);
if (!p) {
o.scrollTop += 2
}
}catch(e){}
};
this.scrolling = function() {
try{
if (o.scrollTop % h != 0) {
o.scrollTop += 2;
if (o.scrollTop = o.scrollHeight / 2) {
o.scrollTop = 0
}
} else {
clearInterval(t);
setTimeout(apthis.doScroll, d)
}
}catch(e){}
};
setTimeout(apthis.doScroll, d)
};
try {
var SinaDotMarquee01 = new SinaDotMarquee("infan2010", 24, 20, 2000)
} catch(e) {}
})();
/script
可控制参数:new SinaDotMarquee():24,字符高度; 20:字符跳出的速度,每60=1秒,推荐20; 2000:字符停留的时间,每1000=1秒,可设100-10000
==================================================
第二种,使用marquee/marquee
=================================================
marquee id="affiche" align="left" behavior="scroll" bgcolor="#FF0000" direction="up" height="300" width="200" hspace="50" vspace="20" loop="-1" scrollamount="10" scrolldelay="100" onMouseOut="this.start()" onMouseOver="this.stop()"这是一个例子/marquee
该标签支持的属性多达11个:
align
设定marquee标签内容的对齐方式
absbottom:绝对底部对齐(与g、p等字母的最下端对齐)
absmiddle:绝对中央对齐
baseline:底线对齐
bottom:底部对齐(默认)
left:左对齐
middle:中间对齐
right:右对齐
texttop:顶线对齐
top:顶部对齐
代码如下:
marquee align="absbottom"align="absbottom":绝对底部对齐(与g、p等字母的最下端对齐)。 /marquee
marquee align="absmiddle"align="absmiddle": 绝对中央对齐。 /marquee
marquee align="baseline"align="baseline": 底线对齐。 /marquee
marquee align="bottom"align="bottom": 底部对齐(默认)。 /marquee
marquee align="left"align="left": 左对齐。 /marquee
marquee align="middle"align="middle": 中间对齐。 /marquee
marquee align="right"align="right": 右对齐。 /marquee
marquee align="texttop"align="texttop": 顶线对齐。 /marquee
marquee align="top"align="top": 顶部对齐。 /marquee
behavior
设定滚动的方式:
alternate: 表示在两端之间来回滚动。
scroll: 表示由一端滚动到另一端,会重复。
slide: 表示由一端滚动到另一端,不会重复。
代码如下:
marquee behavior="alternate"alternate:表示在两端之间来回滚动。 /marquee
marquee behavior="scroll"scroll:表示由一端滚动到另一端,会重复。/marquee
marquee behavior="slide"slide: 表示由一端滚动到另一端,不会重复。/marquee
bgcolor
设定活动字幕的背景颜色,背景颜色可用RGB、16进制值的格式或颜色名称来设定。
代码如下:
marquee bgcolor="#006699"设定活动字幕的背景颜色 bgcolor="#006699"/marquee
marquee bgcolor="RGB(10%,50%,100%,)"设定活动字幕的背景颜色 bgcolor="rgb(10%,50%,100%,)"/marquee
marquee bgcolor="red"设定活动字幕的背景颜色 bgcolor="red"/marquee
direction
设定活动字幕的滚动方向
代码如下:
marquee direction="down"设定活动字幕的滚动方向direction="down":向下/marquee
marquee direction="left"设定活动字幕的滚动方向direction="left":向左/marquee
marquee direction="right"设定活动字幕的滚动方向direction="right":向右/marquee
marquee direction="up"设定活动字幕的滚动方向direction="up":向上/marquee
height
设定活动字幕的高度
代码如下:
marquee height="500" direction="down" bgcolor="#CCCCCC"设定活动字幕的高度height="500"/marquee
width
设定活动字幕的宽度
代码如下:
marquee width="500" bgcolor="#CCCCCC"设定活动字幕的宽度width="500"/marquee
hspace
设定活动字幕里所在的位置距离父容器水平边框的距离
This controls the horizontal(水平)space around the display box.
代码如下:
table width="500" border="1" align="center" cellpadding="0" cellspacing="0"
tr
tdmarquee hspace="100" bgcolor="#CCCCCC"hspace="100"/marquee/td
/tr
/table
vspace
设定活动字幕里所在的位置距离父容器垂直边框的距离
This controls the vertical(垂直) space around the display box.
代码如下:
marquee vspace="100" bgcolor="#CCCCCC"hspace="100"/marquee
loop
设定滚动的次数,当loop=-1表示一直滚动下去,默认为-1
代码如下:
marquee loop="-1" bgcolor="#CCCCCC"我会不停地走。/marquee
p /p
marquee loop="2" bgcolor="#CCCCCC"我只走两次哦/marquee
scrollamount
设定活动字幕的滚动速度,单位pixels
代码如下:
marquee scrollamount="10" scrollamount="10" /marquee
marquee scrollamount="20" scrollamount="20" /marquee
marquee scrollamount="30" scrollamount="30" /marquee
scrolldelay
设定活动字幕滚动两次之间的延迟时间,单位millisecond(毫秒)
值大了会有一步一停顿的效果
代码如下:
marquee scrolldelay="10" scrolldelay="10" /marquee
marquee scrolldelay="100" scrolldelay="100"/marquee
marquee scrolldelay="1000"scrolldelay="1000" /marquee
以上回答你满意么?
怎么样才能把滚动的公告HTML代码放进网站?
用编缉类软件打开公告所在网页,把滚动公告的HTML代码粘贴在你需要的位置。然后保存并用FTP软件上传到空间。再次打开网页就会看到滚动公告的。
语法:marquee …/marquee
使用移动属性marquee,不仅仅可以舞动你的文字,还可以应用于图片,表格等等。
例:marquee direction=left欢迎光临梦泽科技网站!/marquee
direction=left,表示方向。上面文字效果是“欢迎光临梦泽科技网站!”从右向左移动!另外,方向还有right,up,down。
除了方向,我们还可以添加其他限制的元素:
移动的方式:
循环移动:loop=n(n,表示次数) 绕圈移动:behavior=scroll 只走一次:behavior=slide 来回移动:behavior=alternate
外观:
字号:font size=n(n,变量) 对齐方式:align=top/middle/bottom 底色:bgcolor=Blue(预定义色彩,如:Black,Olive,Teal,Red,Blue,Maroon, Navy,Gray,Lime,Fuchsia,White,Green,Purple,Silver,Yellow,Aqua或16进制数码)
其它:
速度:scrollamount=n(n,变量) 延时:scrolldelay==n(n,变量)
marquee direction="向什么方向移动" height="移动区域高度" width="移动区域宽度" scrollamount="移动速度" onmouseover=this.stop() onmouseout=this.start()"
onmouseover 设置鼠标放在移动区域的时候暂停移动
onmouseout 鼠标离开的时候继续滚动
如何滚动公告栏,什么源代码如何滚动公告
1、先给一个例子,下面再做详细讲解
marquee scrollAmount=2 width=300我钟意网页树树/marquee
--这个例子是从左向左滚动
2、各参数详解:
a) scrollAmount。它表示速度,值越大速度越快。如果没有它,默认为6,建议设为1~3比较好。
b) width和height,表示滚动区域的大小,width是宽度,height是高度。特别是在做垂直滚动的时候,一定要设height的值。
c) direction。表示滚动的方向,默认为从右向左:←←←。可选的值有right、down、up。滚动方向分别为:right表示→→→,up表示↑,down表示↓。
d) scrollDelay,这也是用来控制速度的,默认为90,值越大,速度越慢。通常scrollDelay是不需要设置的。
e) behavior。用它来控制属性,默认为循环滚动,可选的值有alternate(交替滚动)、slide(幻灯片效果,指的是滚动一次,然后停止滚动)
3、根据需要设置对应的参数,就可以实现滚动啦,把想要滚动的div标签包含在marquee标签里面。
浮动公告栏的原代码
滚动公告栏代码
在HTML文档中用marquee/marquee标记对插入字幕。字幕marquee主要有下列属性:
align:字幕文字对齐方式
width:字幕高度
high:字幕高度
direction:文字滚动方向,其值可取right,left,up,down;
behavior:字幕动态效果 ,其值可取scroll(滚动),slide(幻灯片),alteernat(交替),默认值为scroll;
scrolldelay:滚动延迟时间,单位毫秒
scrollamount:滚动数量,单位像素。
下面是一个简单的代码
marquee direction=up width=200 id=xjtu scrollamount=2 scrolldelay=80 height=100 onMouseOver=xjtu.stop() onMouseOut=xjtu.start()
a href="#"西交天空/aa href="#"西交天空/abr
西交天空a href="#"西交天空/abr
西交天空a href="#"西交天空/abr
西交天空a href="#"西交天空/abr
西交天空a href="#"西交天空/abr
西交天空a href="#"西交天空/abr
西交天空a href="#"西交天空/abr
西交天空a href="#"西交天空/abr
/marquee/td
滚动公告的代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于网站公告滚动代码、滚动公告的代码的信息别忘了在本站进行查找喔。
版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;
相关推荐
- 05-19web免费网站,javascript中国免费
- 05-19免费网站排名优化在线,网站免费优化平台
- 05-19百度推广网站,百度推广网站公司
- 05-19网站快速优化排名官网,网站优化找超快排
- 05-19网络推广网站公司,网络推广网站公司排行榜
- 05-19免费网站申请注册,免费网站申请注册流程
- 05-19广告网站留电话,广告网站留电话免验证码
- 05-19seo网站关键词优化哪家好,网站seo关键词优化软件
- 05-19怎么免费创建网站,怎么免费创建自己的网站平台
- 05-19建立网站,如何建立网站
取消回复欢迎 你 发表评论:
- 标签列表
- 最近发表
- 友情链接