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

|
网页之跑马灯文字特效
//修改宽度
- g+ X2 x3 |' \0 N+ A' Cvar marqueewidth=3008 c# M0 U' s5 F8 ]8 @$ Z
//高度
* F7 F$ h# g- M3 C% G; t4 Xvar marqueeheight=25
; r5 f' U% y3 C0 I/ r1 V; r `//速度(1-10)
0 u+ T- V8 `! ~, Svar marqueespeed=3; w# V. d$ `) y1 ]; }
//背景颜色
4 J' A2 p3 [" t8 |+ Q* \( ~var marqueebgcolor="#FFFFFF"1 Q3 Z1 z( r' w) Q" q
//是否能暂停 (0=no. 1=yes)?' e T# R2 @: u9 S$ q
var pauseit=1
) |5 ]8 H8 O1 n: ?* l
5 P9 w* r, u4 M% n//修改显示内容0 K: t$ r6 | }4 m% {$ X; L( `
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; p7 x' ~7 G X. Y, p5 B& S
% |/ c! ~/ P3 X) o
; i- l' X' B4 @+ S% S) \4 w////下面不需改变////////////* _) [3 i# q- }1 h. J
8 e8 X$ q: a3 k# G) pvar copyspeed=marqueespeed% f' s9 F6 M5 o/ F$ \9 L, l k6 E
var pausespeed=(pauseit==0)? copyspeed: 0
2 I; c! ?2 S& r- C7 evar iedom=document.all||document.getElementById' k$ V+ b2 L/ B' g
if (iedom)' j8 O( _9 W! R. q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 L U9 i/ L* {8 E+ c
var actualwidth=''0 X* a& ^& z) s m, d$ g5 ]
var cross_marquee, ns_marquee/ R3 L+ k! C" C
0 r6 |7 j( E2 z4 V5 @" Gfunction populate(){6 ~6 H5 v A/ g, S4 D. W
if (iedom){
. B$ A7 J; d% F' J/ E; q9 ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 l7 E7 R8 c& B& U( @4 ] N
cross_marquee.style.left=marqueewidth+83 f$ Q! a' I9 T G$ r. [+ u% E# s
cross_marquee.innerHTML=marqueecontent
# g; ]5 ]* H9 n ~+ E4 t% N zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 \) t L, f% [( P$ g
}
* g7 v& k, V. C1 ~else if (document.layers){
# P& d/ x' N* f# @% u/ Y8 Rns_marquee=document.ns_marquee.document.ns_marquee2
/ B7 j: D5 P6 @ns_marquee.left=marqueewidth+8
7 t! ?# B" |/ n. gns_marquee.document.write(marqueecontent)1 y$ s( m0 M! j& t7 N/ W. A. A& D
ns_marquee.document.close()8 T+ x6 P3 O. p! {! r
actualwidth=ns_marquee.document.width8 N* s# A& R$ Z: `
}
% F; [) i" }$ U+ C' Qlefttime=setInterval("scrollmarquee()",20)
. d" c( p+ A( |& l( }) @}' P2 T H* J4 {6 o
window.onload=populate
; q J; X) n# j7 K+ q1 M" `1 ?1 e9 `& l) [' `
function scrollmarquee(){
8 B7 w% h" \' ^; P: y& o; v/ mif (iedom){
0 J7 u1 ]6 d, xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): ]1 m; s; l9 A" q2 b% Q9 X
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" J" W& }, ~2 e7 r! j9 H, M
else
5 O% r: v! _( e9 @( O" d: fcross_marquee.style.left=marqueewidth+8) |& l; w: Q( h" i# ^
1 A: T4 B+ \6 j- w0 T
}! k& d. K9 [, n" E# T' ?! i
else if (document.layers){
+ _6 I3 f& i4 `/ Q7 P! f$ q, _if (ns_marquee.left>(actualwidth*(-1)+8))
4 n* a/ Y9 Z$ a; G, _ns_marquee.left-=copyspeed
* x" [4 x4 N0 p: k8 q& R6 Jelse
( E3 w: i6 [* } Q7 o1 Jns_marquee.left=marqueewidth+8
& A! Z9 x' q9 }$ y}: K+ X: o) _- I& u5 @. R5 z" N6 t
}" B9 p* @( C# q% B
+ M( H4 ~0 k0 U) I( q8 uif (iedom||document.layers){; y0 }. c( Z. ~
with (document){
6 O1 m% P: ~8 }4 F1 q; c: Jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 y1 t3 s* Q. T" ^1 ~
if (iedom){7 P. s z7 \: S
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 Y( t$ t# ^! z9 K7 I0 ~' M$ w" V; F
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ N% h0 \# X% J2 Y9 Z6 u! h5 U4 Owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' j# a. Z& C% Y( q3 y- Y8 J# z3 Q
write('</div>')
" E3 T8 _ r Z! g Q}
; @: H! l2 J/ [$ `' P3 F6 telse if (document.layers){
# q7 R9 R/ {& y- v3 Bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* x7 D4 c8 b7 H" l+ n/ nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 c6 Y8 q1 Q U
write('</ilayer>')
1 C- i* Y3 [2 H% V/ U/ G: k. f! P}
( j2 d& {' q& i; {; s- gdocument.write('</td></table>'), S4 j. h7 ?3 N; `' ~
}% f1 l, O3 r5 B3 n) i# j
}
S, p2 ]/ H; k8 S/ l</script> |
|