返回列表 发帖

网页之跑马灯文字特效

//修改宽度# S3 x( F! ^3 S. G8 W
var marqueewidth=300$ D7 r% @/ G3 ?: I0 B8 r# }
//高度
) K# c3 O- ^% J4 ~, ?1 \. K+ avar marqueeheight=25
( L$ E% t6 T% J3 ?' S0 v. d//速度(1-10)
* h, B% i9 A2 }1 Uvar marqueespeed=3# U3 \9 Y* W, u  U) \) J( f
//背景颜色7 O4 c$ ^: ~& _  U, D6 z3 q6 Z$ `
var marqueebgcolor="#FFFFFF"3 j9 a% L& n* g, X1 P" l5 C
//是否能暂停 (0=no. 1=yes)?
# f0 b, k# z% C7 Lvar pauseit=1
" ]. D# i% j3 Q  k3 r$ O1 f* O+ K
" v) Y$ a+ r" e# W. C- S' F//修改显示内容' y: h9 T: Y% G6 }( k
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( J# G+ b' \$ u+ L# o; y% s; ]! x5 S) R8 h! C+ {4 f- {

* ?, y& w* ?; B5 n) u, D5 E  Z( ]////下面不需改变////////////
2 G1 J  K1 q& G" B7 Y) s0 b
6 D# R  q7 A0 f8 g, tvar copyspeed=marqueespeed, r) y, Y( Q8 M' ^
var pausespeed=(pauseit==0)? copyspeed: 0
( d' Z4 F* C" h/ W7 l( Yvar iedom=document.all||document.getElementById
( I5 i/ k' |; G+ {if (iedom)$ ^# b; ]( K9 `8 j' H5 d: x
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 w4 ?' N( p0 @var actualwidth=''5 u: l& r2 R' [$ S1 w8 i7 f
var cross_marquee, ns_marquee
0 m; T$ o3 S' D/ n4 X) O4 {' a& h' ^0 e. e0 E2 o
function populate(){$ ^; x7 X/ R4 V8 F
if (iedom){4 y8 j" W5 i1 T1 u4 u9 _. `
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ E5 \; i( [# y6 S. A5 dcross_marquee.style.left=marqueewidth+81 h$ y1 ?& u" o/ T, G/ }8 K8 d
cross_marquee.innerHTML=marqueecontent
& `2 A! T* Z$ Wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 A9 S8 k( u- x. |
}- x- f  |, Q. t( C% U$ ]& U( q7 }
else if (document.layers){8 H% E. I) O' o: ^/ H5 x6 e! O  P
ns_marquee=document.ns_marquee.document.ns_marquee29 Y& L' F* q+ a# T
ns_marquee.left=marqueewidth+8" X& ~9 m( E( e9 e5 x
ns_marquee.document.write(marqueecontent)
  L, s* ~& j( D+ zns_marquee.document.close()/ Z% q6 v, M7 C" ]& ^" I
actualwidth=ns_marquee.document.width
& f6 O, O" v2 J}
6 M( h9 p: h$ z* |# rlefttime=setInterval("scrollmarquee()",20)
3 ]3 z$ B& b0 y/ k5 C' D# o}
7 K9 `7 Y+ B- B7 |) v% mwindow.onload=populate2 `7 E0 `; F- P/ {% S- O5 t% v

0 W+ D3 y5 i9 G" J( J5 ~function scrollmarquee(){% l' g% G/ Q$ j# v
if (iedom){
* b$ p$ m) M/ i' T: Y# X6 @2 q) cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- ?' K9 a) J0 V/ B, K
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ I9 }! v" Y- @else- Q& W+ A' m+ E* w' u  o4 g
cross_marquee.style.left=marqueewidth+8
' f+ t) V; d" }. O# H# }- V) I9 F: Z4 h8 W  N- M
}9 N, R! R- Z* l6 y5 P- D; g, T
else if (document.layers){
3 Z6 Q; r8 [) {5 f7 G% \if (ns_marquee.left>(actualwidth*(-1)+8))' b' x1 d5 [. ~- l, s' E: l
ns_marquee.left-=copyspeed+ F9 a- y) v" o2 h. A
else( p4 O; P/ m- E: a6 @5 ^( S4 X
ns_marquee.left=marqueewidth+8
$ D* V/ b- V9 v1 d}
, U6 p% _, a# s- I}* |# G! X7 J  y% F# x2 T

7 J: z6 l6 U. [* |3 a% Z4 Zif (iedom||document.layers){2 x2 }' ]- a, {( Q
with (document){
& o% ^- s# C/ u+ Y4 ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 D. v; N* u& i2 X8 k- B4 Yif (iedom){
7 ?' ~8 n; H/ h$ ^, L3 Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 w! C7 Y" t; q1 w* K9 ^9 Q" E
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 \! R% N6 T( I4 J. Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ z+ h8 [, O7 w
write('</div>')
% c" U/ R  e+ P% u. T}
+ b2 Y% C9 N6 p& C$ Velse if (document.layers){) _1 D! J) i- a/ T( N, H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), U% b' n% m8 T$ P9 q8 @
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 u5 C7 u3 K9 `% Z% {+ ^2 Gwrite('</ilayer>')
6 g# S3 i) H, n5 h  O" G}
6 M$ z* p% S$ r$ k, t- fdocument.write('</td></table>')
- {; a4 U6 Y. f7 ~/ @}
/ h4 K0 {) V: ^0 m7 t}
& S, f( ^7 a* ]5 F8 \</script>

返回列表
【捌玖网络】已经运行: