|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度4 P. D' c6 a) [% V: e5 r
var marqueewidth=300
1 k- `" b: g9 V; i6 M//高度
( T, C) c S3 p1 Z; hvar marqueeheight=25
! R f& ?+ M% B" `. A0 t//速度(1-10)5 O$ y+ N0 S6 V2 d& S9 I4 L! [2 B
var marqueespeed=35 i: h- {' ?6 m1 b- M* y9 I
//背景颜色
4 a& ]4 U( k0 m8 gvar marqueebgcolor="#FFFFFF"0 G P" a+ H+ k8 K+ p
//是否能暂停 (0=no. 1=yes)?
% \7 E2 b( y/ I* cvar pauseit=11 }$ e/ O" d% W: [
" `6 Y( p/ I+ L+ M5 H# X//修改显示内容5 E8 v) i9 l5 \0 H& T+ s
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') C; M# {% @2 U) T" {
: r$ k0 z- X6 f- `. F$ M C W
; Y' d: n; b' b- s& ]////下面不需改变////////////
( r0 t" M0 e, U5 J% j1 `0 d- ]9 j7 Y6 K# ?+ X: G9 E& N5 T
var copyspeed=marqueespeed
2 b' `7 Z0 f. F9 H+ N5 Bvar pausespeed=(pauseit==0)? copyspeed: 0 X$ W$ s/ X1 X M, q& k0 D
var iedom=document.all||document.getElementById5 H0 X! Z3 j- ~! r& `" k6 l; X2 q
if (iedom)% m$ v( `# _* S, [" j2 q H A
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 Z2 {: h9 A' F% z( Svar actualwidth=''/ p+ B5 v2 S# N) V& `1 G3 J) n
var cross_marquee, ns_marquee
: O. j4 i; ^ u8 f
7 I) L" a# ^6 `1 H% Rfunction populate(){' @9 P8 S; H4 y' I, S* s& B; w
if (iedom){$ U& ?; Z: _0 u# n5 f9 ]" H% E
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- R9 M( X+ `; m) i* A& a- Across_marquee.style.left=marqueewidth+8! ?$ q9 G: ?; Q% D
cross_marquee.innerHTML=marqueecontent
- U d$ N6 W: M/ \, i9 ]actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, Q, q2 _) r# D, C. j% v f) s}
& e% ]$ ]$ E+ a4 K+ \8 s+ |else if (document.layers){
" o4 J/ `& b% R) p$ y" p+ Vns_marquee=document.ns_marquee.document.ns_marquee2- g0 w/ o) C. z. W
ns_marquee.left=marqueewidth+8; z1 T0 m& f6 I2 G2 Q. j% w" U+ J
ns_marquee.document.write(marqueecontent)& Q, b5 Y/ o6 w- F5 k
ns_marquee.document.close()1 J" c8 ~! {% z
actualwidth=ns_marquee.document.width8 Y) n" X8 k5 v2 n O5 c
}7 o+ B/ f2 c* t2 p9 [6 _
lefttime=setInterval("scrollmarquee()",20) q- H, Z7 M8 }, z% {
}
6 Z- g2 p4 c- U& Z* p3 m7 l( Kwindow.onload=populate) v7 K# s/ ^5 u8 p
. J" K8 D4 g& f3 z" U- Mfunction scrollmarquee(){
& V; E4 n j' W; ~4 Z8 Hif (iedom){% `- r! F1 l8 O$ x9 z, n
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 M! j* e$ H/ N+ s
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
\/ _' v' m4 y1 [3 y( Uelse
7 k% a" C# |0 ^+ ]cross_marquee.style.left=marqueewidth+8! Z; k0 T1 s7 B( B$ t6 H0 s
- @* u' ]1 I, d5 @ A}
, ^( D: k% `) eelse if (document.layers){8 j: b6 i V, [/ P, r
if (ns_marquee.left>(actualwidth*(-1)+8))- z9 w& v4 P1 g; N! l9 l; m
ns_marquee.left-=copyspeed
9 u' w1 Y# F$ |* G/ |else) j5 E- x: p! d2 }
ns_marquee.left=marqueewidth+8
/ x; y ?. n6 g9 G1 B5 t9 h7 R}
# p. e9 R9 m4 t}
8 s* q. I; ?: E: T4 N" R: ^' l! j
) N: x+ }( p- Y1 L# ~8 i; \if (iedom||document.layers){
( A! G" ]9 z, `- iwith (document){
7 D h0 N) r* n" X4 Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ E2 X6 F- T0 `8 m6 ^" ]! }if (iedom){
5 w- q, i3 a/ U. @: k0 `/ iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- w* w- @3 c% L, w0 k! @4 d# m, j9 h
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) Z5 w% {+ A* c& T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 U. t2 _$ z: ~9 u- R/ S9 p% }. swrite('</div>'): t# v6 w. ?6 v( Z) p
}
9 h0 ~, X d. r4 n2 ?! G" ielse if (document.layers){
9 ]/ H; V, l, v' bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ D" q3 L# P8 \) N/ dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- v* b. h/ v- T4 ^7 I& iwrite('</ilayer>')/ U+ y b5 H5 e( s1 g0 M+ n
}0 `: c/ J5 t( W/ I9 A2 B- U
document.write('</td></table>')9 S( T; [8 \$ h
}
" k0 H% H/ T' j7 f4 @1 Q}: x9 U5 S+ Z6 j
</script> |
|