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

|
网页之跑马灯文字特效
//修改宽度. Z. S5 T: G5 J9 Y, h
var marqueewidth=300
7 [! D8 m2 D8 L" |1 k* n//高度% d% C8 B/ `# F! \7 m* x2 ^) `; K8 T
var marqueeheight=25% z6 x0 |6 d. X& @8 g& j
//速度(1-10)3 r$ k( W* a/ {7 {4 {: c0 q
var marqueespeed=3
, _" R+ H' x3 B* ` P! B$ u//背景颜色
, P6 \' ^7 f$ l$ v @var marqueebgcolor="#FFFFFF"
, ?% ?4 \. F1 s! a. E//是否能暂停 (0=no. 1=yes)?* q( u4 v% d; Z
var pauseit=15 P+ U/ i" z3 [# V
& T2 t5 [. Z1 B1 b& H# Y6 Z
//修改显示内容, V# S) s" D' o1 F, k2 x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 m3 N+ X7 _ k5 o9 l9 p, u- ?# o* f( w4 o
' N" F" H( w# Y. [ j! Q z
////下面不需改变////////////
8 E* H( U+ C" _5 n3 g
9 H7 G( s/ q% F7 _+ fvar copyspeed=marqueespeed, l$ c+ Y3 z: P; P% j5 w* }
var pausespeed=(pauseit==0)? copyspeed: 0
. N. ^% e: X" v. H" W' d/ ?; [var iedom=document.all||document.getElementById
8 j. q4 b5 M9 u/ w5 hif (iedom)
/ k, o) B. U7 _# }0 E8 D j% Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- F" w9 s* K: X8 uvar actualwidth=''
2 [' Q R* X* }* y2 D( m1 O4 Tvar cross_marquee, ns_marquee' N# i9 L1 q9 I0 P d: J, f/ G7 z
/ C, {0 @3 i, p1 s1 _7 }: Bfunction populate(){
2 ~% q7 @: D( I0 p6 jif (iedom){" p7 p* P; ^8 V7 q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; S1 H. x8 x3 @7 f- \& l- `cross_marquee.style.left=marqueewidth+8
3 n) B% |3 k, a6 Ocross_marquee.innerHTML=marqueecontent
6 B; ^5 I: y: c% N4 J7 A6 eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 n# ^; y& O8 l: I% Y}% K% A" H4 Q5 i" r& F- d5 U* _
else if (document.layers){
9 }' [" k3 \ K7 G# m$ N ~ns_marquee=document.ns_marquee.document.ns_marquee2
- x. o9 M" I x! n+ ?1 Fns_marquee.left=marqueewidth+85 @9 Z, o+ {) q& j R i4 b
ns_marquee.document.write(marqueecontent)- O; F4 S/ a' v
ns_marquee.document.close(); {1 H% [8 C; d5 X2 W: L
actualwidth=ns_marquee.document.width
& d- \8 [. ?) T" W' E- W}
8 d6 }2 B- ]2 e" @lefttime=setInterval("scrollmarquee()",20)
8 n Z' M( b4 _}0 X7 i t9 l/ \) q
window.onload=populate5 Z2 y" n$ X/ x$ o r: ~
3 ~, A8 T) g: Z" M& [; T6 |. vfunction scrollmarquee(){
7 t* R' e/ o* C/ e& M& E- W4 I. K& ]# v; aif (iedom){
3 I$ Z' |9 b& |) W/ Lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 J3 X' _. B) e$ f0 p
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& b! ? U6 z1 {# T5 Aelse' X. [$ a9 ]2 v+ z* V6 @7 \
cross_marquee.style.left=marqueewidth+8; t0 \8 k7 ~* N# G1 I
; w9 H+ ]1 E' C$ C0 t, @) J}9 w- J% v8 l' L3 G
else if (document.layers){
2 x6 |* L, T- v8 W) {if (ns_marquee.left>(actualwidth*(-1)+8))
, R5 T8 X- D- g+ @5 s- ]/ q% ]* _ns_marquee.left-=copyspeed
. T# k4 L" R: T* s$ z7 Kelse
- l, [( f4 x5 x& L! I5 Y9 jns_marquee.left=marqueewidth+8) u0 I( M2 a- d
}
& J& E2 R% V+ V' v- W& {}- w' w( k6 L8 X) B/ j6 v; L: y
( R5 Y2 U# W9 n$ v5 G7 D: O9 zif (iedom||document.layers){9 n$ v8 g. ] M: c% X9 k2 `0 f0 A
with (document){. E0 g5 ^5 B) j, w- s
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>') m" v \5 h: }
if (iedom){
$ p: \0 F k7 Q" Y; h' rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 [8 c0 M8 J& {+ N1 p% j
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). t: f) j" V! U6 e$ [
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 X9 D8 W9 m3 R$ i; Ywrite('</div>')1 h, ]* F9 J* `+ J$ C
}4 S4 ` {- |: a ?1 T2 g3 v3 L
else if (document.layers){
, q0 f2 Q+ ]+ t) a+ k, m$ Xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 e" K: @( G( j( \) E, P4 Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 B+ Z" e F& X' ^2 i! D$ v) cwrite('</ilayer>')
. n4 a3 L/ F/ N p' J$ z}
5 `& c; c1 m! [9 M7 mdocument.write('</td></table>')" Z- A5 b2 W3 Q, Q
}
9 W2 U$ Q0 C- `% V) y% D}
e* o" X) L# o5 H# w% t: l5 |. d# ]</script> |
|