marquee实现跑马灯

<!DOCTYPE html>
<html>
<head>
<title>跑马灯大全</title>
</head>
<body>
<marquee onmouseout="this.start()" onmouseover="this.stop()" id="aaaa">
<div>
<img src="images/haier_logo.png">
<img src="images/ts_logo.png">
<img src="images/jykj_logo.png">
<img src="images/jz_logo.png">
<img src="images/klc_logo.png">
<img src="images/kp_logo.png">
<img src="images/lp_logo.png">
<img src="images/smsx_logo.png">
<img src="images/lf_logo.png">
<img src="images/yd_logo.png">
<img src="images/wpt_logo.png">
<img src="images/ygr_logo.png">
</div>
</marquee>
<marquee contenteditable="true" >滚动的文字</marquee>
<marquee behavior=alternate>表示双向移动</marquee>
<marquee direction=left>表示运动方向向左</marquee>
<marquee width=400 behavior=alternate direction=left align=middle border=1>弹来弹去跑马灯!</marquee>
<marquee scrollamount="30">表示运动方向向左</marquee>
<marquee width=90%>
<a href="http://www.jb51.net" target="_blank">带有超链接的跑马灯!点我试试?</a>
<a href="http://www.baidu.com" target="_blank">还有一条呢!点我试试?</a>
</marquee>
<br /><br />用marquee实现首尾相连循环滚动效果(仅IE7以下):<br /><br />
<marquee behavior="scroll" contenteditable="true" onstart="this.firstChild.innerHTML+=this.firstChild.innerHTML;" scrollamount="3" width="500">
<SPAN unselectable="on">这里是要滚动的内容</SPAN>
</marquee>
<br /><br />用DIV+javascript实现首尾相连循环滚动效果(兼容firefox):<br /><br />
<div id="scrollobj" style="white-space:nowrap;overflow:hidden;width:500px;">
<span>这里是要滚动的内容</span>
</div>
<table width="93%" border="1" cellspacing="0" cellpadding="1" align="center" class="p1">
<tr><td width="42%">参数</td><td width="58%">用法介绍</td></tr>
<tr><td width="42%">behavior=scroll, slide, alternate</td><td width="58%">跑马方式:循环绕行,只跑一次就停住,来回往复运动</td></tr>
<tr><td width="42%">direction=left,right,up,down</td><td width="58%">跑马方向:运动方向向左,运动方向向右,运动方向向上,运动方向向下</td></tr>
<tr><td width="42%">loop=100</td><td width="58%">跑马次数:循环100次,如不写默认为一直循环</td></tr>
<tr><td width="42%">width=100%,height=200</td><td width="58%">跑马范围:宽为100%,高为200像素</td></tr>
<tr><td width="42%">scrollamount=20</td><td width="58%">跑马速度:数越大越快</td></tr>
<tr><td width="42%">scrolldelay=500</td><td width="58%">跑马延时:毫秒数,利用它可实现跃进式滚动</td></tr>
<tr><td width="42%">hspace=20,vspace=20</td><td width="58%">跑马区域与其它区域间的空白大小</td></tr>
<tr><td width="42%">bgcolor=#00FFCC</td><td width="58%">跑马区域的背景颜色</td></tr>
</table>
<script type="text/javascript">
function scroll(obj) {
var tmp = (obj.scrollLeft)++;
//当滚动条到达右边顶端时
if (obj.scrollLeft==tmp) obj.innerHTML += obj.innerHTML;
//当滚动条滚动了初始内容的宽度时滚动条回到最左端
if (obj.scrollLeft>=obj.firstChild.offsetWidth) obj.scrollLeft=0;
}
setInterval("scroll(document.getElementById(‘scrollobj‘))",20);
</script>   
</body>
</html>

marquee实现跑马灯

时间: 2024-08-08 23:10:43

marquee实现跑马灯的相关文章

Android TextView 横向滚动(跑马灯效果)

Android TextView 中当文字比较多时希望它横向滚动显示,下面是一种亲测可行的方法. 效果图: 1.自定义TextView,重写isFocused()方法返回true,让自定义TextView一直处于获取焦点状态. package com.example.shen.marqueedemo; import android.content.Context; import android.util.AttributeSet; import android.widget.TextView;

Android:TextView 自动滚动(跑马灯) (转)

Android:TextView 自动滚动(跑马灯) TextView实现文字滚动需要以下几个要点: 1.文字长度长于可显示范围:android:singleLine="true" 2.设置可滚到,或显示样式:android:ellipsize="marquee" 3.TextView只有在获取焦点后才会滚动显示隐藏文字,因此需要在包中新建一个类,继承TextView.重写isFocused方法,这个方法默认行为是,如果TextView获得焦点,方法返回true,失

浅谈TextView Ellipsize效果与跑马灯

说到TextView 效果,相信大家一定熟悉跑马灯. 先来看看 Ellipsize是什么,Ellipsize 从开发技术上翻译为省略效果.故名思议,就是当文本无法显示全部时,用什么效果来显示未显示的部分. 一,What is Ellipsize  and  How to use ? 首先我们在Android XML中需要这样定义 <TextView android:id="@+id/textView" android:layout_width="wrap_content

Android 文字自动滚动(跑马灯)效果的两种实现方法[特别好使]

有时候在xml中写的跑马灯效果不滚动:原因有以下 Android系统中TextView实现跑马灯效果,必须具备以下几个条件: 1.android:ellipsize=”marquee” 2.TextView必须单行显示,即内容必须超出TextView大小 3.TextView要获得焦点才能滚动(如果还不行,就要用自定义的TextView控件中重写isFocused()返回true就行[方法代码在下面的AlwaysMarqueeTextView 类],但是遇到新问题就是界面有多个这样的控件显示时当

Textview在Listview中实现跑马灯效果

textview添加属性: android:singleLine="true" 表示单行显示 android:ellipsize="marquee" 设置当文字过长时,该控件该如何显示.有如下值设置:”start”—–省略号显示在开头:”end”——省略号显示在结尾:”middle”—-省略号显示在中间:”marquee” ——以跑马灯的方式显示(动画横向移动) android:marqueeRepeatLimit="marquee_forever&quo

关于跑马灯的体会

1. android:singleLine="true"虽然被不建议使用,但是跑马灯必须是它.如果改为android:maxLines="1",不能实现跑马灯效果. 2. android:marqueeRepeatLimit="marquee_forever" 是否使用,没关系. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

android 跑马灯

1.在TextView中实现我们的走马灯效果,需要两个属性android:singleLine="true",以及android:ellipsize="marquee": 2.跑马灯效果需要TextVIew获得当前的焦点(focus).然而对于TextView这个控件来说,他的默认的Clickable,LongClickable,Focusable, FocusableInTouchMode这四个属性的值都是false,所以跑马灯效果也就不会出来了,即使你用手触摸T

Android textview 跑马灯 要加的属性

<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="@android:color/white"  android:ellipsize="marquee"  android:focusable="true" android:singleLine = &q

TextView实现跑马灯效果

使用setSelect(true)来实现, 当然Textview 获得焦点后也会跑马灯 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height=&