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

|
网页之跑马灯文字特效
//修改宽度
* B, q6 d! H: ]- { Rvar marqueewidth=300
$ f" E0 p8 j; r$ U8 w- {0 ]//高度4 r* o; w" v9 D6 V
var marqueeheight=256 k: ?/ G- w C! C. ]9 y
//速度(1-10)
8 v' A: |# e+ n/ |8 w+ w- zvar marqueespeed=3
_! t0 I/ b' S$ p: [//背景颜色" `5 S1 y; A5 g* ~$ j$ B) U
var marqueebgcolor="#FFFFFF"
y7 e" T6 d2 s% m- K7 E) q: j//是否能暂停 (0=no. 1=yes)?
7 _- L0 {" ]5 }var pauseit=1
+ n/ O) |5 @% C, X/ R3 j' d/ v' D/ n# k: J: q- K* v
//修改显示内容1 |" K4 \) e; S
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; u' j1 L* y j% z2 g4 N( [
7 `; c: H3 y$ B9 L) i4 k$ p5 _5 }2 ?1 R3 C9 {, f: C( y/ A
////下面不需改变////////////
9 I' D$ E- T$ G& Q' v
* Y# z6 O! s* v8 y* Gvar copyspeed=marqueespeed
! s& [4 H- ~# V/ e! w- J- jvar pausespeed=(pauseit==0)? copyspeed: 0
) L9 N. k; h9 H# C2 C8 Mvar iedom=document.all||document.getElementById+ R; M9 F7 m- `; f. N
if (iedom). V- x+ W4 k& k6 \9 k
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 S' B7 L" Z8 e7 }9 F* |var actualwidth='' y: g: Q" b3 G+ g5 F; g
var cross_marquee, ns_marquee
4 z; a; D6 Z* r7 b; n
% i3 U2 Q; a2 t1 Z% a: Sfunction populate(){# ]6 G& V- F7 g1 b* O8 B# L
if (iedom){& |3 N% P# u& }3 u" X( f! h
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ |7 F7 Q: u* ~4 g7 o, gcross_marquee.style.left=marqueewidth+8
; m1 f( O3 P3 xcross_marquee.innerHTML=marqueecontent
; `4 O: n6 i. `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 \8 C/ [7 z1 N- k, t" p}
8 r# ?: ^9 i6 U6 l$ a' Xelse if (document.layers){
6 O8 h V# M/ p$ Gns_marquee=document.ns_marquee.document.ns_marquee2
/ u- ~9 H7 F* L |+ j2 Kns_marquee.left=marqueewidth+86 n1 D+ x- X7 w: l7 a" E# v7 |4 u
ns_marquee.document.write(marqueecontent)- \* U6 H6 E. A2 J3 |& h
ns_marquee.document.close()
$ j* T$ @ A' e* V+ T% [$ m aactualwidth=ns_marquee.document.width! n, b0 c/ k' C" d" A7 O: p1 b* d* M
}
% M' \8 V7 Q+ L5 \$ {# R' Rlefttime=setInterval("scrollmarquee()",20)
8 o% r. Y2 X1 p7 A! g1 z/ p7 H}5 a& T( S: O# ?# r$ w
window.onload=populate# _( }7 P9 N+ m
5 ], G" Y x! @0 efunction scrollmarquee(){# ]7 Y( i* E# S. a6 q
if (iedom){1 d' J' C3 e2 L0 z# @
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 ?; [! i+ Q9 u% }- p
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- ^# \8 Z8 X' Y0 X- T4 G1 y# i
else; Q- ]/ l7 K% _* U
cross_marquee.style.left=marqueewidth+8
2 U! x- a0 o7 D/ b4 d! _
, v+ \4 c' [: v}
9 I7 P m9 \! X/ A$ d7 Y; Welse if (document.layers){1 R+ f- s2 v% m6 Z/ ~# l# l* Y
if (ns_marquee.left>(actualwidth*(-1)+8))
& g" o: s+ ], @5 ]- r# @ns_marquee.left-=copyspeed' }5 S1 K7 k+ H
else
; F) ~7 ~" ]5 E% O2 ans_marquee.left=marqueewidth+8$ F+ U) f( m. z* B. o- d' U
}3 d$ N" S4 o6 i9 ]/ n+ A7 ~, L
}
9 L& `: V( i! r: b* s& I
* p7 Q4 I l8 c) T8 \- @. hif (iedom||document.layers){; n% J7 N2 _; G& V$ r
with (document){4 V" ]: T! t H: r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 A* \0 p( }0 |
if (iedom){
% d. P) F, ?! Ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); k/ ^& r+ x! F; M3 |
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) [: [" a. n7 Fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. T6 w: a2 V: z, R8 Rwrite('</div>')6 W0 x" \1 E) y
}
% S% Y0 `$ u, q0 f5 P4 Telse if (document.layers){
1 r# J! A2 u( j& D* z& m- b+ owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; W% Q, }2 n1 E. c X; ^' o3 fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 c% l* ^5 S+ u- i0 I! K$ K5 p0 ywrite('</ilayer>')
( \7 A1 P* v" @}7 ?% e: b; {, t; L: Q Y0 G8 D* b
document.write('</td></table>')
i1 q' S8 ? H8 i}9 @3 }0 s" j H+ j: o
}, @" X8 P0 K4 u
</script> |
|