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

|
网页之跑马灯文字特效
//修改宽度
. a$ y* Q7 v) O( O) R5 x' mvar marqueewidth=300; E. F" p1 P, d$ m
//高度8 i7 O4 @- T' \' e
var marqueeheight=25& [9 `0 Z* b6 A1 `1 l9 J
//速度(1-10), _ q) b; o% Q+ A/ S4 Z, v. K
var marqueespeed=3' G% W/ J' V2 Q2 j7 o4 \7 J
//背景颜色
. c2 f; _5 ^: {0 `/ ]: X- g0 hvar marqueebgcolor="#FFFFFF"5 u7 R8 m; Q" A$ H2 z5 p V0 _5 D
//是否能暂停 (0=no. 1=yes)?. C4 x0 q+ N. r. Y
var pauseit=1
' z: }8 q$ \$ _4 u/ q1 D
9 x: H- k0 }# o) H/ K! m2 q/ ^6 G//修改显示内容" h+ Q% \$ @" Z: T n: J
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' V3 e' H! |# O/ j+ i* m. U4 |9 s9 I
2 v9 D& n/ I: P" b2 L. W5 j, I) z/ R% {- V& f5 f
////下面不需改变////////////
: ^7 r6 [4 {! z" z/ f1 K7 P, _
! h' o9 G; m; b# h' Y. Avar copyspeed=marqueespeed7 a' r# X' A- i c1 S" {# q- d% l
var pausespeed=(pauseit==0)? copyspeed: 0; N; B9 q: @; c) V5 I c6 B
var iedom=document.all||document.getElementById
! t3 A: J3 V1 ~ Nif (iedom)
* S f% s* A6 y+ f; G! adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' R$ g1 Y# i. C1 {$ `' E" Q
var actualwidth=''
* r+ m% Z4 K9 E0 G. O/ O* s$ ^var cross_marquee, ns_marquee; k* S; \9 `- k2 Q, u$ K) Z, K
2 M- ?% F) h! r3 x1 A: A$ Y
function populate(){
+ {* W" {0 a8 f( [' f6 ~if (iedom){+ ^, x6 G3 F- m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 h( [$ s6 m' W. F$ q: S, D3 X
cross_marquee.style.left=marqueewidth+8
3 o% x! ^6 U6 D7 _& m8 ccross_marquee.innerHTML=marqueecontent
2 V% ^, T2 O/ ^8 q5 factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% G5 L2 J v) h0 q}5 e3 L; O4 E- b4 P) p2 i
else if (document.layers){
* O( [# S4 ^3 t* P- @) tns_marquee=document.ns_marquee.document.ns_marquee2+ C6 K* c+ c5 Y/ R: I) P
ns_marquee.left=marqueewidth+8
/ r3 u1 u# M+ G8 u" t* Wns_marquee.document.write(marqueecontent)
1 k3 R# z+ j& i$ D" X5 r9 P Y6 Nns_marquee.document.close()/ Z! P! D' A; E4 P1 e! ]' l
actualwidth=ns_marquee.document.width2 o* J6 V+ h7 p1 j$ o* |
}( ?3 ]1 X2 l0 z5 f9 G2 P
lefttime=setInterval("scrollmarquee()",20)
! t6 r8 P1 }9 q/ N}, e* D' z" G& [) V
window.onload=populate
. j" |2 Q) _8 G! t
( ~! A/ q/ L, k% Lfunction scrollmarquee(){
" a2 P1 M: |$ R& q) xif (iedom){9 ?2 ^1 B) u5 L; K( L$ g' z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
y1 q- F1 Y! U3 f6 j( bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% Q' W! F% V( X6 K& z
else$ s* i" _7 b9 _( l* X
cross_marquee.style.left=marqueewidth+82 x4 I Z8 Y0 y* e6 y
! \; k' h+ k1 d, w; N2 m7 {& p}
1 Z8 U% [9 b4 felse if (document.layers){6 g& J+ X( H1 E( q" |% h
if (ns_marquee.left>(actualwidth*(-1)+8))- I3 ]7 k/ n4 W8 [2 o/ ], L
ns_marquee.left-=copyspeed
U0 l' A( n- Y9 |else1 `# e! ^4 c+ d7 ~ ^
ns_marquee.left=marqueewidth+87 T& q: t4 `. M3 N* d( H
}$ R, w# b9 \0 Z$ U- {. p. T
}4 w" U* s% ~& p$ s6 p! v: ]/ @
2 w* F, G- f/ y; B( \4 a5 J
if (iedom||document.layers){) g1 A* F; Z$ q( M- k2 `' \, J8 @
with (document){7 j" Y7 A7 ]4 S S0 l% |; X% C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), [; c5 I" P( G, [0 O$ p4 F
if (iedom){8 A2 O* A/ ^ ?3 x9 ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' x L# l+ L# Q+ n3 Q6 V; H2 X8 hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 k" D" j! x- k+ y1 T# f: e/ N
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* G( m: a( d& L- O: K+ V* o
write('</div>')+ G" f4 D: D" n' V8 K( _
}) N; G- k6 j/ M( G- w
else if (document.layers){
1 t! b7 n2 k8 r5 M. L7 h) K: T9 Qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), W9 d& T% R, x9 K% ~1 _! E
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 B4 G. @ S/ j$ Awrite('</ilayer>')
0 O4 s C0 m. _1 W7 \}6 D1 L3 t8 J, i" E$ W Z6 u
document.write('</td></table>')
' e( ~# j- _; L}
, f1 i, M+ S9 ^$ ~9 V2 Q}6 L! y* F! D% x8 H
</script> |
|