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

|
网页之跑马灯文字特效
//修改宽度3 h9 s( O2 y S* h6 {; v
var marqueewidth=300
; F- e) g% C# ]* R8 r) M+ l* n2 e4 _//高度
* q0 p+ K. h' b! q) ]var marqueeheight=25
! S* k, I" Z0 J) q0 [1 |8 [; E//速度(1-10)! M& y R0 S2 ~. X4 Y" G% w9 g0 C) E0 w
var marqueespeed=3
) @5 k( T+ _. }, m2 q' `//背景颜色
8 w2 M, N5 I6 B# Z$ V; ~var marqueebgcolor="#FFFFFF"+ f p) s/ p: X7 U) p, o% D
//是否能暂停 (0=no. 1=yes)?
1 Q) v4 |* b% g: Gvar pauseit=1
7 c/ n, |. o( F5 p- R$ S6 Z$ f6 U* P& W3 s2 E/ K3 s
//修改显示内容) D) w3 F6 \" O" }+ D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( |# u% y8 N/ p6 s0 @
: `* ]1 F$ U' w& |" P3 J
1 G& q: W) a" Z" W1 O////下面不需改变////////////
. ~+ a0 X {' ]; J
: o8 o3 c ~/ u4 H+ Ivar copyspeed=marqueespeed
- W+ w+ r0 z9 D: ^+ i- f1 e- bvar pausespeed=(pauseit==0)? copyspeed: 0! I% W4 Y [ b6 F8 v7 h
var iedom=document.all||document.getElementById$ M, w) |# V1 y" n/ R
if (iedom)
' s3 J: ^$ k9 {$ ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& g7 h6 \9 K7 \var actualwidth=''
* h d1 P; Z$ Z$ q) [var cross_marquee, ns_marquee! x' H* w3 E, _3 W. _
) |# S# n! w; \, p( J0 L
function populate(){/ i4 W* S3 n' S0 q3 c# _& E) Z9 W
if (iedom){# z4 L3 _" N8 C+ l( \
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# ^4 P2 w, D! l& \) L! R4 Ocross_marquee.style.left=marqueewidth+86 Y( t y% F9 ]
cross_marquee.innerHTML=marqueecontent: [* v3 G( E+ U; I/ P) @0 i0 n8 B
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 n2 ^3 n8 n3 W. R) d# ^9 ^" A}7 n+ \5 L1 z4 }# Z
else if (document.layers){( M ^7 J0 a" K$ N- z& e
ns_marquee=document.ns_marquee.document.ns_marquee2
- A& D' h8 M6 Q' v/ t+ @ns_marquee.left=marqueewidth+8. W G3 ^. l/ l
ns_marquee.document.write(marqueecontent)0 R6 {$ p! ]( r4 t8 |" e
ns_marquee.document.close()2 _ f+ E/ F: u6 B3 G/ c8 F
actualwidth=ns_marquee.document.width
3 y, d V" S3 l1 k2 n3 a h}
3 f( M* Y" s1 @5 K+ m' Ilefttime=setInterval("scrollmarquee()",20)
0 } \8 M% w5 I3 ^5 S* @ ~ z}
4 ^& B+ K9 @4 Z. a# awindow.onload=populate6 T$ [2 o6 }. h; u7 x7 q
" I6 b) v, T) { e: sfunction scrollmarquee(){
. a$ ~2 O* A% [4 F, wif (iedom){
, U, `/ {. |4 @+ }; m# }1 C+ x0 ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ P6 ?4 @( p/ n3 N5 C) [- Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; b% q! X* n d8 y- |# v# O
else
' |, i- X# w% N6 \- a0 u" ecross_marquee.style.left=marqueewidth+80 {5 Z4 \* ]( B8 k
. n [8 C3 W! u G8 P1 s}" u4 F% d ^% e! F
else if (document.layers){
" N }' O( T) u. z" Tif (ns_marquee.left>(actualwidth*(-1)+8))
" L; D P9 S7 P! I2 vns_marquee.left-=copyspeed
' o+ A4 H% A* d+ h; _% B2 welse5 `& O. n2 E& N4 F
ns_marquee.left=marqueewidth+8
# Y* a2 O' l, Z) J}
8 X+ }/ k* y+ m5 F; n/ C3 W; n; s}
3 X' N3 q1 S. _1 D4 X
2 Z \5 x9 E7 ?: F" Mif (iedom||document.layers){
9 e0 q7 w8 T0 Mwith (document){
% J/ O; G$ y# Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
E1 d$ u2 i8 p& n1 Zif (iedom){
. T7 g8 N( D9 Y. _( i8 rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! S$ @6 }, r8 Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
{7 A7 S* Q6 z/ U* i0 g9 ]1 Gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') I/ s. x( A1 Y7 o% }" D: C1 V
write('</div>')
' Q/ E* i/ A* k8 X- m ]}& x) `" I$ O( d, {7 a
else if (document.layers){5 x8 H, k. j# x7 ~4 ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 o+ N8 t* k a( p) O0 y0 S* W0 L" V
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' f9 D; D# G, k8 P
write('</ilayer>')
" z2 Y/ T/ Q' l! o, k* ~ h/ L} Q0 C6 R1 B) O6 p4 G( p
document.write('</td></table>')/ v# e" q( ?- x6 x: R3 |5 G. U3 w+ }
}
. n* R( ]! I \ a1 a( V}
3 r B, W. d/ N# n; w f</script> |
|