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

|
网页之跑马灯文字特效
//修改宽度
* ?; N/ ^- L: J3 g2 E/ I3 T; t, avar marqueewidth=300, d8 h, q: }$ E/ b7 C1 `" O# q6 `8 y
//高度
- I% b3 ?+ F t% g8 p" Xvar marqueeheight=25( S' }5 T D- M% M/ z! n1 t* d2 X
//速度(1-10)* E6 N' Y9 A: G: M X+ U1 b$ }+ v5 Y
var marqueespeed=3
+ `$ a% j, c- ~& t; X+ J//背景颜色: E3 O/ k( m8 g: _5 p+ |
var marqueebgcolor="#FFFFFF"
( [8 F3 B; C1 y' J, a, d* u//是否能暂停 (0=no. 1=yes)? R; P: X" M' g' ?% ?' s
var pauseit=1
/ E1 o2 U# K- I* R! z! s. [* a8 R1 I
) Y: B7 x$ ?5 V- A; [//修改显示内容0 N& ], V4 D4 q; ?& p
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% w5 D5 }9 L! a2 A. |5 g% U% A
5 m# S- m5 p- J! _5 M9 ~* }% T: Z' U! t8 A; \
////下面不需改变////////////1 u: a2 ~1 }. Y; m6 ]. \, Y4 a' E
. y% F9 I$ _( v7 i, Q0 z
var copyspeed=marqueespeed
/ \& @/ x# I& m" {var pausespeed=(pauseit==0)? copyspeed: 0. T5 M- w' T/ F4 G" j4 L. b
var iedom=document.all||document.getElementById2 i. g% W+ p4 \0 |
if (iedom)
+ V- `8 x, V3 B1 z: _0 H* j6 e' pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% o; i! r q) Q3 c. a
var actualwidth=''
7 |3 G" K( ^( i$ j' Mvar cross_marquee, ns_marquee
3 l3 D9 p# O* m) W0 c$ G8 p# [% @8 ?$ W
function populate(){
5 @7 [+ d! X6 R% y0 sif (iedom){; H' S: ~5 {3 w9 E+ d R0 T
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 i3 J B1 v! X; ^cross_marquee.style.left=marqueewidth+8
3 ^$ P4 J! ?9 ~, f" I, \cross_marquee.innerHTML=marqueecontent# Q! Q7 _$ x3 a8 l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 d7 D- n; E p- S3 x y( b
}2 v$ G) \5 R- ?/ e
else if (document.layers){
( U l* s! b7 m% c# Z( Rns_marquee=document.ns_marquee.document.ns_marquee2
! w: S! a) J9 wns_marquee.left=marqueewidth+8% S5 m7 V' f+ W5 s2 x
ns_marquee.document.write(marqueecontent)
. Q1 o& D$ |2 A9 Nns_marquee.document.close()& M% o& G. J1 `- w+ @2 K; `
actualwidth=ns_marquee.document.width
/ _+ |+ a) y& A$ k& e6 N3 z}8 E8 }& V% r6 b, r
lefttime=setInterval("scrollmarquee()",20)! X' U9 g8 E X' H. F0 W# W" C
}
F0 w3 D2 f% b+ }. o6 Ywindow.onload=populate
0 F" e2 S& m, b) v: `* i
6 @: ]" R8 c+ p+ n5 Efunction scrollmarquee(){
$ Q* D; Z/ R c9 _; rif (iedom){
" n$ \/ E% T6 Z( a+ C0 u, jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" { m8 }4 m3 \( l4 T
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# T& Q8 L# z2 x- b2 p, y7 Helse% z8 W. K/ x' s/ s6 Y$ e8 G9 L* c
cross_marquee.style.left=marqueewidth+8
, a6 b+ P S2 w1 P. @2 m8 U G0 p; Y
' g4 l4 h: ~4 j7 ~% A}! G c0 F( i5 m$ j* W
else if (document.layers){
9 C, a8 m* d0 C* f0 n- V, uif (ns_marquee.left>(actualwidth*(-1)+8))
R6 ]/ {, |$ \' mns_marquee.left-=copyspeed5 i" I" B5 ~( w- o; p2 M H
else
8 B6 {. W; i k: J: ans_marquee.left=marqueewidth+82 K1 Q' f8 I: ?- |: M( U( @9 v
}9 B2 ?8 u) g: |! G D4 N7 M/ s1 p" Y
}
~- `. c- x& l0 K+ M* a
9 g3 D w* V5 M2 f7 |if (iedom||document.layers){
5 a. @+ @9 ^3 l! \7 Ywith (document){
6 U" T+ m7 B% u, h; Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 y7 Z) a7 q" \, h1 i: x; ?) i+ nif (iedom){
- m+ Z \7 W4 T# D4 awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' S4 [1 w1 ]% b9 X% M% qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 s* l; y, p2 h& P1 D
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 E! w* |% ^' R% c9 O
write('</div>')) s4 O# H# R+ u5 Z/ S( |
}8 A2 |, I; s1 a; r7 y( Q) u
else if (document.layers){3 n% j0 r6 U! z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 l% _, y. D. H7 D1 Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) Q ]; U) K8 M
write('</ilayer>')' Y8 B! _ C. Z4 f% l
}
3 F1 _$ g! }8 v2 G. h" j ~document.write('</td></table>')
! \- i3 b( q1 ?5 e2 k: A" n1 ?}
& G/ ?! i7 S8 `! C1 J}
1 l4 w4 s7 K! j% e% R</script> |
|