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

|
网页之跑马灯文字特效
//修改宽度
7 [6 q7 Q3 ^0 ~3 v& I- p9 ivar marqueewidth=300" a, Y, p& n! m) z: u4 q
//高度
& H3 T/ M" \- F; I- ~5 Rvar marqueeheight=25$ w l; m! t4 f/ ?9 F
//速度(1-10)
; f, O9 C' u3 y" Z* Mvar marqueespeed=3
% j J8 F# P ~//背景颜色' n" [9 X1 d" s% d
var marqueebgcolor="#FFFFFF") T+ H% M6 _, ?9 S
//是否能暂停 (0=no. 1=yes)?
) e* J' q- p" e' \/ Y7 V* `var pauseit=1- z6 J, W* I8 {
6 ?2 O, i2 H3 L4 P3 Y//修改显示内容9 w( Y3 A$ `* L7 x) V( X7 c, }
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 g0 O7 F$ Y3 T( o
' t( F. h9 a; T2 r+ G
2 |4 i1 _/ k! q( B0 z////下面不需改变////////////2 \+ g {" R S+ U3 C
9 E, o9 C/ v t ?
var copyspeed=marqueespeed1 I( ] N& ]: z
var pausespeed=(pauseit==0)? copyspeed: 0
; T0 W5 k! u2 Nvar iedom=document.all||document.getElementById
: N5 {1 L' v' y4 ^8 V6 y! E) hif (iedom)3 b8 U) f2 v# {/ p
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' z8 O: O7 l6 m% t9 W4 fvar actualwidth=''" E' e n# C" Y; T& ]. Z
var cross_marquee, ns_marquee% C2 x& ]3 ~7 ]& C7 x, u1 e3 ?( N. q
8 o$ y6 \) y' M! I9 _
function populate(){2 p( X0 X' W$ e
if (iedom){
: l v1 x1 @& y# F6 r. Scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* p3 j5 P' a7 K. w' e1 fcross_marquee.style.left=marqueewidth+8: H$ r9 M4 n7 a" F% k* w
cross_marquee.innerHTML=marqueecontent! X: o& C( l) Z5 l2 m8 Q! B/ \6 u- O
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 X+ Z) _- f0 q+ K
}" ?" } G7 n" e& y' b2 b
else if (document.layers){
- U2 S# c! e% S1 Q$ D0 ?ns_marquee=document.ns_marquee.document.ns_marquee2
( `. M1 F( j( e. @* fns_marquee.left=marqueewidth+8; c) x9 X- V' r% D- u+ m& r5 j$ g
ns_marquee.document.write(marqueecontent)* n; v$ B7 N" m
ns_marquee.document.close()
P8 d* _# g# C, m9 _: Factualwidth=ns_marquee.document.width! O2 }/ }% W6 n, k
}
H& S& ]/ @: T8 _1 ]7 ?lefttime=setInterval("scrollmarquee()",20): |( x. W& g, _/ s8 J* \( K
}% Q2 h! W) D3 P1 w8 l. J0 S* n# m
window.onload=populate) v" P: O2 t& @& \, f& ]
5 T- j* h( c7 W9 L+ M2 kfunction scrollmarquee(){
4 W: A5 ]! N6 k+ A8 A- Tif (iedom){
+ L, f* D# P L2 Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, D: U$ J. b( w ^* j0 ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 E$ ?% o5 [( d, A, f9 Eelse
- y/ W3 u* [. |4 u! {cross_marquee.style.left=marqueewidth+82 B% m b. x5 y' Q D& ~1 s
5 [! r6 ^+ ?- ~2 q$ h+ Z
}
4 y# a2 ~8 O# A3 u$ `5 \* E) Velse if (document.layers){
' g8 r) B$ S/ g9 a9 Eif (ns_marquee.left>(actualwidth*(-1)+8))
# ]! T% Q! f- e- }. C8 m1 ?7 nns_marquee.left-=copyspeed
/ V/ E* V* y- w1 d% Gelse
8 X. y- ?( o. H0 u4 P& l3 N- ens_marquee.left=marqueewidth+8" [, N$ z% ?# s6 ?! e- Q
}
6 ~/ s" D; ]$ K+ o$ `; k) v}( R% t* k6 x$ d/ g, K @ H
+ n' }' ^" [& M! r4 ^0 A# G* n; kif (iedom||document.layers){
8 d7 C% S$ p$ W8 X* swith (document){
- e; H3 v9 }/ T' _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& U4 E0 D4 r$ }% [/ b1 J( x
if (iedom){1 X# V5 w! O. }3 V1 j# c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( j& O' F2 [5 ^
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 ?0 @3 ], m& p' s7 N' e; p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 [- n# U r9 G# r% p& Dwrite('</div>'); K# C2 s' t7 R8 @, M+ ?
}
$ C+ u o6 o3 u8 Pelse if (document.layers){# O/ S4 b" I! s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 c/ Q6 k7 [1 D& F7 e# Z# U9 Fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! A: D* h2 H V( X) {
write('</ilayer>')
1 o- }* e( R* t8 j$ ?! z}! n7 c/ v9 j9 c0 G0 [4 k% B. R
document.write('</td></table>')
0 ?+ ^5 o0 K/ b$ G" r. A3 Q& [+ X}
0 ^2 |6 f, n( E# J2 `2 R) ^}0 ^( O5 w- T+ B5 V7 B3 V, `
</script> |
|