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

|
网页之跑马灯文字特效
//修改宽度
- n6 z; D+ X+ Y7 _) k* Fvar marqueewidth=3008 D& \: f% i- A8 G& s% Y
//高度
+ x6 P/ R$ @& t8 L' P* L( a" {var marqueeheight=25. \2 s( C5 r% @4 Q: m
//速度(1-10)
% M' V% L6 w4 V) e# _var marqueespeed=3
+ O& d8 d7 {& K0 M# {: H7 s//背景颜色1 j6 v8 B5 n. q! \2 c
var marqueebgcolor="#FFFFFF"8 t1 h# f$ i ]8 L P- M4 Z/ B
//是否能暂停 (0=no. 1=yes)?2 k; i) j( f m# w3 ]
var pauseit=1. @& V3 q5 i% P1 F% @
- r8 H# {7 ~; h+ U
//修改显示内容
4 j6 j" Z. ^9 w% @3 m2 E+ o; rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 H. e1 Y I% [, K% ^5 X6 t
$ I1 z" L% _2 I/ p" y) K2 p9 ^$ N9 O- {- Y% N
////下面不需改变////////////
U" F% `" u) s5 t- w N
3 |. L$ r7 f1 r; _7 x. |9 j7 m8 Qvar copyspeed=marqueespeed
7 Y1 {7 D) ^& T! L! Mvar pausespeed=(pauseit==0)? copyspeed: 0: r; b0 Q) U5 N( Q
var iedom=document.all||document.getElementById$ ^3 e/ b6 y, v7 M% X( o
if (iedom)
" m8 n5 C9 D7 _7 Q& n+ ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% R' _4 O4 a+ c3 C1 Jvar actualwidth=''; T, A' ^/ r J. T% H
var cross_marquee, ns_marquee
, C3 F, b5 Y% Y2 ?# N8 L
9 `% W* L* a% o2 d) Ufunction populate(){
, i& z4 y8 }" k. ?if (iedom){
8 ?$ W" Q& {: u- p+ h1 h, vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 I7 S! ~: m3 n5 x! ~- w
cross_marquee.style.left=marqueewidth+8
8 q5 c8 J6 H6 o6 k; U: wcross_marquee.innerHTML=marqueecontent ?- o' K( f' Z, a
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ l+ x, W+ }6 z( |' q" v! L+ S
}
' Y; O: G* D# r# g% |else if (document.layers){
3 N, F1 f3 }) D+ i3 @ns_marquee=document.ns_marquee.document.ns_marquee24 N8 _8 y; U' M5 S
ns_marquee.left=marqueewidth+8* Z* ?5 V7 Y, o2 }$ G$ J }
ns_marquee.document.write(marqueecontent)
9 X8 m X5 G( I' Y! E* H4 U( Dns_marquee.document.close()6 l5 Z% U; y c, z) q3 D" |
actualwidth=ns_marquee.document.width
8 U. b; P9 F3 G& f. ^6 n! I}
& z6 z6 {7 C: S2 ilefttime=setInterval("scrollmarquee()",20)' u6 I7 b2 i- T9 ~/ z
}
: ]( I6 N$ H6 xwindow.onload=populate
" M0 K1 K5 T) l% R* a" r0 C. o5 e0 i) h! I* c+ R6 i
function scrollmarquee(){
8 k U; G7 _9 i& s* ?8 i3 Aif (iedom){ G9 P" g/ i8 N
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ f- u, N4 }! z4 \6 ]% M- B" M
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# I1 M4 L4 o! z2 t
else
* z ^3 [9 ~# t9 zcross_marquee.style.left=marqueewidth+8
. h7 _) n8 W3 p7 W6 p
0 P. A3 K+ l5 m" F! `' `}
; B' i6 ] N7 ~8 _8 Felse if (document.layers){
. g2 g2 ~" w6 k [if (ns_marquee.left>(actualwidth*(-1)+8))$ a# P1 ~( M4 b' U2 H
ns_marquee.left-=copyspeed
# L7 L y: w; z+ `2 helse& x8 [: l; w$ s" [9 A, J! y& Z
ns_marquee.left=marqueewidth+8
+ Q6 c& i! \: J6 p% s& R9 N b/ c}" D' O g1 d: w+ T
}% E: R; ~/ m, k% v# u" f6 i0 n
& w2 y% a S/ v9 R% Oif (iedom||document.layers){
1 ?# M4 I/ W0 Z0 l9 I$ s+ ^with (document){
0 n3 A& _- t V- A/ t. Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! U# U" a; c; z! x: ~' j
if (iedom){9 z% D; t$ j. a3 p* x. L: [
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). n' i2 F" m- L- G# s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ L, D$ }) l8 e! bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 t% x s$ v0 i$ a; D
write('</div>')
- H' o% z: H" A+ j% {7 R}
* I- ]# S9 }3 S7 n( A# telse if (document.layers){
/ `& K9 d2 _. a! j1 J9 @, r2 E+ Owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 U! V* n( F+ ~8 V+ N; B5 Mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 ~$ `- x% m- z# o" _
write('</ilayer>')
: E# X7 U3 `! i3 ^}
0 G* G5 ?- m1 odocument.write('</td></table>'), d" @% m/ B) p G
}, s a9 l- B, H5 o6 X, w5 |
}: Y9 v) t: }7 `: ?. c
</script> |
|