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

|
网页之跑马灯文字特效
//修改宽度% k2 Z0 g* }1 V: }' }) ]) X, s, v
var marqueewidth=300( j' y- r, H+ o- T) c* R/ X
//高度4 u: L5 g. J. W% v2 H3 Z
var marqueeheight=25' e4 @3 ]) _5 `$ e- }
//速度(1-10)
/ K$ ` |7 m! o; m. R$ vvar marqueespeed=3. I) C4 e C: X0 q
//背景颜色
5 F( ]1 ~0 E! }! Z3 c/ Mvar marqueebgcolor="#FFFFFF"
" b" x0 l: Z6 F$ j//是否能暂停 (0=no. 1=yes)?
/ g8 I3 ]* z" A$ t9 ~var pauseit=1
) Z. @/ i- q% b# k; y; t p }' b5 F1 N/ {+ B, l, K8 B, l
//修改显示内容
% W" G/ U5 Z3 D& Nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# A% L) X8 Y9 g- P
$ f4 V3 s* ?# U0 ]
, x* v6 H6 g* D" j////下面不需改变////////////
* _6 P, u% T' _& b
N* o1 ~; t% ]$ X! mvar copyspeed=marqueespeed
4 S+ d0 q* w% u, d4 i! Rvar pausespeed=(pauseit==0)? copyspeed: 0
2 t. u" j/ B, ]2 ~9 f7 Q: lvar iedom=document.all||document.getElementById
! z9 J+ W% ?5 ?+ q7 @6 y7 o" R3 kif (iedom) n) o v6 J U$ I4 o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, L& s/ q8 I M- Yvar actualwidth=''
6 j; C9 o. \% P3 p7 t8 gvar cross_marquee, ns_marquee
+ Q( c1 G% w. i ]' @
) G6 f0 J4 e& f2 U e/ a! jfunction populate(){8 {' }! _& A) F; n1 I1 F
if (iedom){, K2 H" z" {! k; K. _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 d# Y' t% E% c- a" Dcross_marquee.style.left=marqueewidth+8
: p- k2 Q C: \3 j' dcross_marquee.innerHTML=marqueecontent
6 Q. a8 D* ]/ y1 G/ s2 ?8 g) [) [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" G! v" D+ N# U% H* G7 s8 U1 Q}3 e& |, j& X* B L& T' `3 e
else if (document.layers){
0 a! J+ H8 B9 vns_marquee=document.ns_marquee.document.ns_marquee20 A2 ]9 q" N6 [. K: d( w! j
ns_marquee.left=marqueewidth+8- X. I8 U" @& ~* @! m
ns_marquee.document.write(marqueecontent)
! ~+ a v; i5 v9 ~+ lns_marquee.document.close(), m, P1 c: j' T7 q# D
actualwidth=ns_marquee.document.width
: D$ y* l& U, X* }}: k T7 W7 s% y
lefttime=setInterval("scrollmarquee()",20)
4 e7 G- I9 G" ?$ d/ C}
; F. D! d+ S, C. Dwindow.onload=populate
& U. c ?7 ?" Y( U E6 N
7 e! l9 Q7 e" A/ j( {# `6 g" Zfunction scrollmarquee(){0 L8 U4 U7 A" T
if (iedom){
1 S) N& p& m( `" [! j6 ]; Xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 x; {) I6 A- {- A# H8 g' Q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% @( N; X, o5 D/ w8 relse
0 a0 B2 R% s# o& z$ @$ j7 E Icross_marquee.style.left=marqueewidth+8' |1 ?$ }0 x" y8 x
+ s1 i" k) `$ n# m
}/ e# w; P* D- k( n5 S# k
else if (document.layers){6 ]/ y5 S: C3 ]# a4 f# f
if (ns_marquee.left>(actualwidth*(-1)+8))
. z1 p4 g6 S- Q' G) p/ w/ jns_marquee.left-=copyspeed
( U; D" t" I: kelse
- H* L8 F& x! ?4 V, ^0 o9 T2 \- Y' L4 ]ns_marquee.left=marqueewidth+8
. E' n! n* [& q( {2 T& G8 k B}0 Z0 q( h" {& L5 G
}7 S& l+ G' F: g" n
7 T$ a8 y5 Z: V& V( U: }& C
if (iedom||document.layers){) ~2 z* v5 I; A
with (document){
$ Y0 S5 f3 T- G1 |0 Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ n, l' N+ v7 y- `3 t) n2 g1 g
if (iedom){
( b( |5 V8 P: s( y$ i% W9 Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 j# i( l5 v- v: a m$ @5 s Swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 L! }( r2 o/ q: O+ z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) [( z- {, N; H7 twrite('</div>')2 h' f3 Z3 y# D2 k t" A
}4 ]9 S" D( X8 @* S6 J: Z
else if (document.layers){
8 {. L R7 f# a9 O' T) W0 p2 L/ Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( n3 M; Z o+ j; ]+ c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ I" Q+ |- a: ]: h' h
write('</ilayer>')
3 G5 e" P% n& F \* m1 r}2 \* T- Z/ ]: I
document.write('</td></table>')0 T6 _* L2 X+ I) [; i/ z l
}) G# v5 {; ]9 v. q9 z; r8 c
}3 l) J( j) z8 C: K! K6 N
</script> |
|