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

|
网页之跑马灯文字特效
//修改宽度
& }8 Q: ~- h3 M# G4 p7 T- N" T8 Evar marqueewidth=300
5 \% d% a' p7 |2 L2 V. S//高度. t W* S4 ^5 h3 U+ X/ Q3 }* u
var marqueeheight=25, W8 g! I' o3 l& x8 l$ W
//速度(1-10)% p: r2 P0 |" r4 B
var marqueespeed=3
6 @9 F: P4 h6 l. ?5 l9 ?//背景颜色, \+ `" c7 K' E0 Q
var marqueebgcolor="#FFFFFF"
" p* z. m w7 t2 j//是否能暂停 (0=no. 1=yes)?
8 C; s* A1 C5 m- ?var pauseit=16 ] @9 q5 {0 E/ I
2 \% Z7 K0 ?' J3 _4 T; H. y//修改显示内容/ b$ r4 j: f) j; ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ X8 {1 f# G" H+ y# x) W: n
; [1 u. M0 y3 Y
: k! k4 @+ N* O5 K) O' _ @
////下面不需改变////////////
G% h2 |# }% J
s9 I0 b$ t3 D2 Qvar copyspeed=marqueespeed7 w# h1 P- }) \
var pausespeed=(pauseit==0)? copyspeed: 0& j0 b3 D: o# f6 s) o+ B9 T
var iedom=document.all||document.getElementById
$ Y# ^7 C5 y6 E& o6 N; |9 @1 Eif (iedom)
6 m: R) g- b$ T' @7 cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- Q. |7 e# O4 f- [! n
var actualwidth=''
7 k4 s: z" |0 Q7 p9 c+ Bvar cross_marquee, ns_marquee
8 t) c) v) m3 A4 ~% E+ ^' X; J1 i: s7 o1 J% y/ R
function populate(){
9 |; P @" _0 m5 V U3 p8 Dif (iedom){5 I3 c! \) r- J1 x# W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 W+ s( B2 p& O, Y0 m
cross_marquee.style.left=marqueewidth+8
) k0 S K! K# @cross_marquee.innerHTML=marqueecontent$ {8 ~8 {% y/ Q( t2 X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% D- Q1 q' I+ |}) }2 @$ i$ _. f/ V9 I/ ?
else if (document.layers){! r: S0 y h* h6 @6 Q' p5 ~
ns_marquee=document.ns_marquee.document.ns_marquee2
1 b A7 _) ?# mns_marquee.left=marqueewidth+80 i& N: K) c4 X6 Q ?4 }+ j
ns_marquee.document.write(marqueecontent), T; f! t# T7 r$ N1 @3 w. D7 c
ns_marquee.document.close()
: D" ~/ g! B2 X2 {actualwidth=ns_marquee.document.width
A9 ?( A6 s) S# `. C}
" z" k' X E- a% L- h1 V5 qlefttime=setInterval("scrollmarquee()",20)
. ]% a T( p2 ~' u/ g0 Y}2 l; @+ I& \$ t- U
window.onload=populate
% A$ P+ e* y! p# o( N J) E8 F
7 n5 y* N: ^/ C8 Jfunction scrollmarquee(){* k+ _: i+ _9 ?1 Q
if (iedom){; @' ^. R6 A* ~9 v: s2 A) F, u
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( G- u$ I M% vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 j2 v# A. f h/ h2 x1 g4 r' K. {
else
1 \: s' i# F* ?2 a1 x7 Jcross_marquee.style.left=marqueewidth+8! f4 f/ p: F# d: K$ t2 d( K1 w' M
& |3 x. i9 A1 d* @3 {; H6 q
}
+ Y/ D G, I1 eelse if (document.layers){* \( H7 F/ f* |& r0 \0 y
if (ns_marquee.left>(actualwidth*(-1)+8))+ O8 s' f1 d6 ~5 K! e: }7 o
ns_marquee.left-=copyspeed
% ^# I$ ~/ U i/ P: Nelse7 c: r" }% Q) ^+ ^0 g5 X( A
ns_marquee.left=marqueewidth+8
& V# @) E" ?* g+ F}
5 ]; Q- `& y" [) }6 v}7 m+ I( ^; Z& E9 y1 B E: U% w+ d
4 Z7 L3 o5 g7 a2 P# X2 pif (iedom||document.layers){/ J1 j* w. ^7 p2 M
with (document){2 Y$ a/ P+ l2 q' R. M! o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( A5 c' m) m! p, k% g
if (iedom){
1 i: e3 A5 i7 A0 K8 t) S2 [ D7 m2 Twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' i8 a- ~7 L$ S+ t; }3 ]write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 C+ ^$ D2 m+ L# {% } Z# Gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 N3 l& y1 T: {) O! r) f5 Cwrite('</div>')* H7 r8 M9 U5 N y
}
4 \, K! z) H) e! {$ Lelse if (document.layers){
, h% n) W3 B, a+ cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- P2 G7 n" N- F2 D7 H; [! p
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, v* W F1 R% }$ g& U+ Cwrite('</ilayer>')( e* s5 Z; j* ]$ ^& D R8 X" v/ L
}. F' z0 N2 o# J
document.write('</td></table>')
8 @; Q* I% h: I* U$ i5 Y @}! H+ G/ }! E0 S7 @ f0 r
}. n9 K/ i: h/ q9 C2 }, L! W8 x3 _! F
</script> |
|