返回列表 发帖

网页之跑马灯文字特效

//修改宽度, z5 p  `& G. @9 P5 i% `
var marqueewidth=3008 g/ e7 }  O/ @3 z3 N
//高度
9 A: T2 n7 j, Z" ]# Uvar marqueeheight=253 j/ t0 c& M5 y6 e4 O
//速度(1-10)
, n. b) j7 x0 v2 Nvar marqueespeed=3: M+ z' K6 B, k+ p7 x) r
//背景颜色
+ ]4 t% @7 K  i% T  B* Vvar marqueebgcolor="#FFFFFF"
! m( Z! d- k$ k- C//是否能暂停 (0=no. 1=yes)?
, |0 X! o- r" y( `) W: bvar pauseit=1
" F/ q0 Q) T8 _/ ]5 G6 D
7 a6 g, F, B; [0 H1 U) @//修改显示内容
- y/ G& {/ O, \4 k0 U2 x6 H8 s0 wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! n# D2 Z9 I  s  j4 u

2 D( L5 u7 y0 Y0 Z" I
  Y. V) z( |( u# X) I  k+ l////下面不需改变////////////
! p  K; K/ R: G6 |5 }0 T
0 b! `+ n$ n1 uvar copyspeed=marqueespeed$ l. g; L, Q- q& j1 w: ~
var pausespeed=(pauseit==0)? copyspeed: 00 L9 P; y0 P$ e* V$ o
var iedom=document.all||document.getElementById4 i9 g0 R5 {  `" R  l
if (iedom)
6 _. I% M+ V+ h( E! _3 k1 k& n9 qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ e! h3 Y- L- N' Ovar actualwidth=''/ f) b" A7 J' ~
var cross_marquee, ns_marquee" Y5 H7 B: d9 J* N% x% @/ t

. W2 x, ^/ U5 |- S1 Nfunction populate(){. x, I. T7 g  e4 J1 l, @2 M# H! e  ~
if (iedom){6 J3 g# n/ o2 S; l; ~) I7 J9 R
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 _& ], D% e, L
cross_marquee.style.left=marqueewidth+8
+ J+ S' @: _, z( f5 U! Scross_marquee.innerHTML=marqueecontent
1 s( V8 |- Q2 Y% ~1 cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" g0 ?1 Q4 \+ E
}: j* j! i' k# }6 c+ `7 v6 e1 _# G
else if (document.layers){
: m1 U+ d2 A, @, _4 K- Ans_marquee=document.ns_marquee.document.ns_marquee2* f9 Q, d8 L" y% j$ [, Y
ns_marquee.left=marqueewidth+8
& ?0 l. h" o, Q6 a% D7 t4 sns_marquee.document.write(marqueecontent)" N, n3 y. ?% a$ }
ns_marquee.document.close()% e7 n) u8 b5 I% l. P5 V9 q
actualwidth=ns_marquee.document.width+ W3 v, D2 O! ]$ h5 Y1 k: Q
}( p, ]5 I; G( z  l/ x
lefttime=setInterval("scrollmarquee()",20)3 a) w# q. C& n
}5 d% D" i. k0 V/ B! b
window.onload=populate$ M' T8 q% x9 B& q' M  ]
, F. O, ]$ F& t4 C) \
function scrollmarquee(){, E/ ]( }- y$ Y! s; |8 x2 T6 d
if (iedom){
0 @2 p, D# [- p% }# Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: @) p2 G! j2 p6 b' M! `8 B* I  H0 Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 j; d. _4 d+ s7 telse
, T" P, A# `# k" l- i# j& |1 t3 t# Ccross_marquee.style.left=marqueewidth+8
1 u0 e8 e% c" t% I( |. m. N! ]& a
  \3 ^; [! r! d( ?}
3 t! U' ~" S( j9 G. Eelse if (document.layers){% O% a! k* e- I; V7 w+ y) M
if (ns_marquee.left>(actualwidth*(-1)+8))2 i- ?0 U, y" \/ Z+ V+ y+ x
ns_marquee.left-=copyspeed8 w) ~% Q" p- R9 W1 B, j2 T) O0 H
else
3 o7 x4 [8 ~+ I: D8 {- E) K% Wns_marquee.left=marqueewidth+8
: s4 q: c) H; o* d}
+ C3 h; N' {* X4 D% g5 T( o4 [}
( R8 w2 Y; L+ @, g7 w; n& V; [# I+ e! P
if (iedom||document.layers){
+ }4 _* A( t( g& l3 Hwith (document){
2 k! Y3 w3 Q" J2 a$ {document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 x/ c/ L; E% @$ D8 j
if (iedom){) c5 _- Y# |) G$ {1 p
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 P0 K, L1 i5 k- z; s% qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 y9 b" P. v6 {# P# o* ?3 \# f0 ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')  x! @. `; T* t
write('</div>')
; d; N7 z; \7 D  {}
4 h: l9 p* W% e' velse if (document.layers){1 p. a/ O. X4 A( w8 F+ \
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 _$ D) _* G! o2 d9 E& C" t3 S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ ~0 B9 p: z3 L4 B. f4 [1 K
write('</ilayer>')( l: K" U3 Y2 |4 q/ Z4 s- ^& a
}
6 h3 h! \4 B/ D2 \document.write('</td></table>')
1 c: ~, u# F- A9 s; ]6 p9 B}
5 p& P, o, S  O( m# h8 K% m% C6 r}  T* L: J1 p# @
</script>

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