返回列表 发帖

网页之跑马灯文字特效

//修改宽度
/ H( u. h: s" G3 Q. z! _% g! ~var marqueewidth=300
  C' n9 h; h. o7 S$ ~//高度4 O$ H2 u0 v) S0 l& g2 N( w
var marqueeheight=256 a. @: H  `, Y7 ]. B
//速度(1-10)
4 V- A) P* l/ x: \5 ]( ]$ I; E% Ivar marqueespeed=38 x) _; U5 ?, T, m& ^  o! V
//背景颜色
$ n4 a  E) c# w) g8 zvar marqueebgcolor="#FFFFFF"; [, M2 ?1 c+ M) d& o6 @2 s! ?
//是否能暂停 (0=no. 1=yes)?
* l& M3 j  O, [0 ~1 f4 H; Evar pauseit=16 \+ \. {- h& X1 Q/ g* g9 j  N

. p' h+ g9 d7 U$ P//修改显示内容
! s% q3 P3 w9 u5 r: Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ A7 ]" y: ]3 i

- \0 A4 w9 z' M5 w4 g" `5 r" G, A/ I+ N, A
////下面不需改变////////////
; r1 {' w) x! Q% Y) a' Y0 d& G6 f8 K' [1 n2 r0 u+ G0 F2 k
var copyspeed=marqueespeed4 |/ b& V) l9 z* ?  a$ X7 u
var pausespeed=(pauseit==0)? copyspeed: 0
& S  x6 G2 o# {$ a0 n3 Xvar iedom=document.all||document.getElementById
; _8 U# F; j+ [; l3 Hif (iedom)
# A; F6 V# y. e2 _" N! [0 Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# C% ]) y) e( x
var actualwidth=''! N6 c, M* h( B" g3 E
var cross_marquee, ns_marquee# y! j8 l/ `- X
: k, ?4 P& \3 L$ K- \
function populate(){% v; \) e9 W5 G/ L2 e
if (iedom){
* V  P' C, s: ?: }9 d- W4 v3 @' Ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: `4 |% ]- M) R! }6 m5 s6 {2 A
cross_marquee.style.left=marqueewidth+8
1 y: b5 v7 l$ x1 J. j# N* E4 fcross_marquee.innerHTML=marqueecontent
8 `, L8 B3 K7 a/ x7 `& tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" Z& u7 T9 W6 U5 O' \}6 M/ Y( Z( w; d+ O- [$ m
else if (document.layers){6 ?: G9 o* K0 I5 e  g0 `) v9 |1 V
ns_marquee=document.ns_marquee.document.ns_marquee2  |5 J; j! ]* {" r
ns_marquee.left=marqueewidth+8
- [7 g3 W4 w3 ~/ Fns_marquee.document.write(marqueecontent)
8 }& v9 m  @& y1 \ns_marquee.document.close()3 i; B/ U: p2 o; X' J1 M
actualwidth=ns_marquee.document.width
3 P) O2 Y( o/ c+ [) f, T}3 {) o+ B4 ^1 ^7 T5 B) ^" W1 Q
lefttime=setInterval("scrollmarquee()",20)
8 H5 }7 b+ J4 X  c5 p1 z3 C& f}
' {. z: n2 z, zwindow.onload=populate2 {8 s1 K. C: X; ~, R" I+ u- \; ]
5 I3 j8 o2 ^# j( C% v, g) X. e( v
function scrollmarquee(){+ x! t1 K- w- y6 t  A; z0 |
if (iedom){
8 e" T* p( {2 `; W4 G- Mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 b# v( {; y8 b5 Q6 l4 Gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ }. d- d! I; J, t9 x$ M
else/ |, A7 G) u  P+ ~0 s- Z$ k; j
cross_marquee.style.left=marqueewidth+8+ w: \: I  ~& l. p

" o4 O8 b- ^0 |+ ]% u}
; h* V# l- z! relse if (document.layers){
2 J* t2 u3 e# x) M* A$ L0 |if (ns_marquee.left>(actualwidth*(-1)+8)), X8 P) D+ a! t  Q8 G
ns_marquee.left-=copyspeed* ?7 b: ^$ Q" i! ^+ }
else" o& {5 F, [2 z, C: @: U
ns_marquee.left=marqueewidth+80 a6 b& l  n* X* p
}! r  w# F) Z) G+ \+ N9 X
}
. S/ Y% n! Q4 G8 O) |. S, t( g& G9 _# [) G
if (iedom||document.layers){
; B4 g1 C' q3 T0 x. Vwith (document){
, K( E* c2 W# x5 {8 k* Ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# n: h3 c, ]1 q1 l" c" G
if (iedom){& P2 V+ K7 ~+ Z/ N' f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 i# B$ V; T6 P* P* {! Owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& f9 x- M) i, G: S+ E$ I( l
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* u5 U3 c" t- x4 ]9 u# c
write('</div>')5 }3 t, O+ {( A1 H- o7 g
}
; E9 i( s# L2 d9 pelse if (document.layers){
+ R5 T! \4 b! a1 r; dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# O. r; \- Y( C6 p$ l/ P* `  Y3 M0 Qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 r  ?4 D( N$ ?2 W# mwrite('</ilayer>')
3 I" A# {) K1 U, D3 s8 M}
8 c+ B7 j" @3 p/ Hdocument.write('</td></table>')
3 ]/ v; w1 \8 E2 \}
* \, s5 d% G. r% c% d}
# U) T  y% q0 }) U" N) {8 \  p</script>

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