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

|
网页之跑马灯文字特效
//修改宽度
" }# j) K$ X) Z" zvar marqueewidth=300) F! @5 ]- A {+ ^$ h/ o
//高度3 ~' b1 S- W' v# m7 C0 P
var marqueeheight=25+ f8 @4 n7 x, {. ?+ q, p! V0 f4 M, w
//速度(1-10)& R% e8 w4 b. S; O. b. d J4 j
var marqueespeed=3% ?# S& b, L4 u1 ?3 d. j
//背景颜色
! J& M3 M1 D/ D! a& ovar marqueebgcolor="#FFFFFF"
: ^% T1 H9 t2 Q2 M5 V# d9 y( o7 z3 C//是否能暂停 (0=no. 1=yes)?
5 ^5 A) q$ h3 i2 n, u7 Y" ivar pauseit=1; I* P5 D" ?! q5 S7 `0 S) R
+ K& B% x) I$ U# D* H//修改显示内容
" K ]$ ^ P& `7 M7 g) s0 vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) S& } n1 Q' v9 s, S. f b, B
: {+ _8 I8 C9 k7 d8 B' U% x: }4 _
8 Z9 t, e9 q5 F1 E2 \$ S4 M////下面不需改变////////////$ F1 u T# K. ^; R
8 J' ~: V0 O3 l4 g" f9 w- t+ H4 qvar copyspeed=marqueespeed# l2 u6 [# A9 J' e- B
var pausespeed=(pauseit==0)? copyspeed: 0* ?/ T5 A4 m0 e& I% ~
var iedom=document.all||document.getElementById7 K Y) L/ x. O" e' e) ]0 J. T! I$ `
if (iedom)/ w& k X7 Z& w
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( @# u4 V9 q# P9 O8 a* pvar actualwidth=''! e6 T: n8 X l y/ O- l
var cross_marquee, ns_marquee* I. n# Z( g' u
, @8 h) e) f9 M. j, ?( Dfunction populate(){
$ }1 \8 ?4 m; L5 Aif (iedom){
' P9 _( X9 O: m: G* C( a! n" \9 Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! Q4 z; f, c I# M' }: f! x, Fcross_marquee.style.left=marqueewidth+8
, I/ j6 g% k! c5 R: F3 h6 E/ _& hcross_marquee.innerHTML=marqueecontent
, G* G$ G8 t5 u/ w9 [+ mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 l9 E8 o9 ?! F! X}: p% Z [- N" v
else if (document.layers){
" v4 f8 n5 f' z, ~/ sns_marquee=document.ns_marquee.document.ns_marquee2
# w8 N8 W4 G6 x0 A, S/ X! E+ Uns_marquee.left=marqueewidth+88 {4 L7 I) T; V) O$ T/ Z* Q A
ns_marquee.document.write(marqueecontent)
. M3 s7 F" o) ]& e* @/ J6 dns_marquee.document.close()8 a% e M. E$ c: l6 a3 g
actualwidth=ns_marquee.document.width: d' o, Q: j5 _8 b E# d
}
+ S" c9 R+ a+ s) q$ q5 k4 hlefttime=setInterval("scrollmarquee()",20)3 m- z. n4 m& ^, [
}
: ^, H p+ h& T# qwindow.onload=populate
, g5 A7 ~! Q6 K& H5 z
% Y/ y! S- z% S0 Cfunction scrollmarquee(){
3 u9 T4 Q/ O( h1 U; jif (iedom){
! J4 z6 z% Y5 @2 lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! P" Y+ `6 E% g$ y9 R/ n8 F( `& ]3 rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 p# _3 R9 B6 R3 Lelse; s. f& [# ?3 i- |, w0 A& w# [
cross_marquee.style.left=marqueewidth+89 z6 E4 u- ?0 c" K5 g
4 K6 H* @3 `0 J5 U( T! l9 R- G
}6 q3 }+ i+ g; Y+ L+ j- D$ Q) L
else if (document.layers){6 A2 G9 R! U0 a! E5 E- _+ N
if (ns_marquee.left>(actualwidth*(-1)+8))2 e y- ^5 E& w6 S0 T( E! Y; ]
ns_marquee.left-=copyspeed
$ `3 V5 E3 ~! f& H+ I2 M F8 {else$ L2 d, r) X* k! O+ H2 A8 V8 j; x9 n1 l
ns_marquee.left=marqueewidth+8; h1 ~' H S+ t% k9 X! M
}
) |* o6 _/ p" S/ f5 U0 [. H% B: B}5 u) U+ u. U' p$ c$ ?
! T% b1 u, k, `0 bif (iedom||document.layers){$ y# G5 X, c7 r8 m' l3 `
with (document){, p6 |4 T) F3 B- [6 q; r; z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 E3 r% J. O9 xif (iedom){
; L' V; D, P/ _: x2 \4 \' Bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% t0 V* b6 |) c6 O0 R& p! R0 Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 ~6 k2 L' M, I9 }write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) }0 j' w/ K1 |: o1 ]$ {1 f2 ~: A, U
write('</div>')
3 }9 @4 z' B( {}
' p1 h) C0 H |" D# uelse if (document.layers){* e# X: f6 s' K9 Z! G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 G9 P0 v( P R: k
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 {6 g1 u( e1 M g% ], V3 U9 L
write('</ilayer>')$ b: Q7 c! M T+ Q1 k! l; k4 b
}
" Y/ O! X- u8 tdocument.write('</td></table>')
, |( T' B( f+ Z}/ k X$ a1 L; H1 i0 w+ d
}
& {0 P1 d; n' R! P& r6 V</script> |
|