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

|
网页之跑马灯文字特效
//修改宽度
% H6 | `' P; M+ f9 d) O+ tvar marqueewidth=300
7 g1 a& U6 C" F- U9 a+ [! X& \//高度
* r& T1 x I1 s2 rvar marqueeheight=25
* o6 x% C6 S& ?& f( t//速度(1-10)3 y, N* e: t$ x
var marqueespeed=3
2 t3 \/ W7 y( q- o8 D1 x//背景颜色7 h; f' ]: y4 h' [3 n2 q1 h
var marqueebgcolor="#FFFFFF"
) a! i {* V" X/ Y8 h$ W- ?# l0 |3 m# X//是否能暂停 (0=no. 1=yes)?
% [/ x5 Q8 J; n- uvar pauseit=13 V7 y( z8 h4 A
; d/ ~- F6 _0 w6 N* }* Q
//修改显示内容# y( Z% |9 w, V$ m% |$ X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 C# r! K/ T1 _
5 G+ f0 o* h! K+ ~
& v) {4 v; B5 M2 }8 h////下面不需改变////////////7 G& ]- q4 S8 E1 Q8 ^2 r0 C) r
* o7 X% i! k- X
var copyspeed=marqueespeed& x3 j& {+ `: F# ?2 B
var pausespeed=(pauseit==0)? copyspeed: 0
# V/ C+ X* T2 u- }* Zvar iedom=document.all||document.getElementById
: Z& T& `* c2 V; F3 a2 R% Z# n2 Oif (iedom)& x8 H) e# E# S6 Z, A! ?: y) F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ f' z; i/ L9 Y& V# ]% D; J$ s; i
var actualwidth=''! A" N0 C, j& l; |
var cross_marquee, ns_marquee
! ]# m3 K% u0 [- } r" X( z! h
3 @! ]! b( S' d# Nfunction populate(){
# {, t, D: i, R: J# K" V) E7 |if (iedom){
8 n3 G, g9 Q& ?6 A) J) Scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% ^0 H. z! v4 v) Y; K1 K
cross_marquee.style.left=marqueewidth+8
# ]8 i( R; F4 } D& qcross_marquee.innerHTML=marqueecontent
) w: o& z3 U& c1 o2 }actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 S3 k- N6 e5 y}
" ^: o$ {/ c2 s* s, w5 _else if (document.layers){
$ V) @% q s: D7 I# l# @ns_marquee=document.ns_marquee.document.ns_marquee2
7 \) y& W" _. }+ lns_marquee.left=marqueewidth+86 [; `; \! N* I( u- c9 [# @
ns_marquee.document.write(marqueecontent)! U! v5 i+ P% m& }
ns_marquee.document.close()
- k* _/ V4 v7 F* \" J' C, zactualwidth=ns_marquee.document.width; y: r' p; [+ i3 Q
} f( T1 g& i# _9 T
lefttime=setInterval("scrollmarquee()",20)
7 z, q, m1 G4 Z: w' z}; f' F u& E* R. `: k9 |, F5 {
window.onload=populate
5 h) M+ f _7 k( r" h5 j
9 M s' P; k$ Z* w! b: O* Tfunction scrollmarquee(){7 r: L& ]7 x$ l7 H
if (iedom){
7 ~3 K% D3 n/ Q: Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 A" F$ g' o- |% y8 ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, O# C" J+ a* p* o% g7 |# U9 Lelse, O, O: C( a; q' g0 [8 Q2 ]4 ]
cross_marquee.style.left=marqueewidth+8" D# X# y" {; `. ^* ~! _
& |; g; ^4 [% f2 e
}
# v1 [7 G3 b" H! ?) o, E4 welse if (document.layers){
; ?- ?$ B7 I; T8 ^# a" ]if (ns_marquee.left>(actualwidth*(-1)+8)) E. i& e3 b0 Z2 @- A7 F
ns_marquee.left-=copyspeed3 b: Q2 z% U7 P- k& [
else# u; C7 r5 Z( H
ns_marquee.left=marqueewidth+8, @( `$ A3 j- D0 w
}
. R" k) }- F; Z# c3 f0 ]}( w" c& H" `, u
/ k M) w& N) x8 T- S
if (iedom||document.layers){
- i$ W! A- k9 A ewith (document){
+ V7 e" j2 p3 odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): E9 ^( b' v' f- t5 ?) K) n8 u5 r
if (iedom){
; }" H9 \- g7 ?+ b9 ~1 }$ Dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& c4 D+ ^2 A' ?3 }# }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- y0 [' R" F' P2 O# C: ]/ o& ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ ~9 D0 N& w/ D% Q) N/ ewrite('</div>'), x( i* l F1 b
}! O. n2 D1 r! L0 V& N: ~# h; R. p
else if (document.layers){
' A' c! i. c& C7 D# Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" I0 k. j7 x: X- l4 d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
z" V9 o9 K; \( B* I. O9 Lwrite('</ilayer>')
7 C& g- Q- m2 O0 _0 v! @}
+ P0 |6 F A) s: v7 g/ ldocument.write('</td></table>')
4 P1 d* ~, ~- M$ w. K; Z}
. v" a. a! M$ k2 A) v2 v}5 \) @! `4 d* `; m
</script> |
|