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

|
网页之跑马灯文字特效
//修改宽度. ^4 M$ q3 J2 M
var marqueewidth=300
+ X; F9 R3 @- ?9 C//高度
( V z' s; Q9 U/ ovar marqueeheight=25
8 V$ b9 z" p: o" E8 M, B//速度(1-10)& K$ M2 Y$ S5 h0 G+ R0 `, D0 ~
var marqueespeed=3
; X p* ~8 k( v- K& e//背景颜色9 _2 H G' O) V
var marqueebgcolor="#FFFFFF"7 d# e2 s) w( ?7 B; u' t4 N
//是否能暂停 (0=no. 1=yes)?8 w. ]7 {5 E! L) X
var pauseit=1
" p" L/ j% W7 J, c" v/ C' r) e) W6 u) q& p2 x* T) }
//修改显示内容' Z# w$ B9 y% [9 p: L$ B* \
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 Z' G9 K2 k& C- W
1 ?. E9 C3 B* `$ o8 ^( `
6 _9 m6 H8 |& r" E) r////下面不需改变////////////6 Z5 ] T) [# E" O5 c
% A. b/ q1 a0 ?2 V) Gvar copyspeed=marqueespeed
* ?' E7 h5 n+ B, svar pausespeed=(pauseit==0)? copyspeed: 0" D" s! K# X! R) Y) O
var iedom=document.all||document.getElementById/ x4 Z$ u, I; W
if (iedom)
3 z# `3 ?* O9 q( j) _' [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 n* i) ^0 C. _2 B. S, p. X
var actualwidth=''" B& O* u6 q. h# `& h& g
var cross_marquee, ns_marquee+ U* y% o& W) y9 c" b n- w
* m" U' L5 m1 k" b$ x, l: j
function populate(){
7 q! e1 l3 k' f- h* }* Sif (iedom){% G& p( d+ w: h0 w$ F' ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 D: b" A, H3 a! Ocross_marquee.style.left=marqueewidth+8
" N0 Y7 [+ O" X- F0 o; Z, ecross_marquee.innerHTML=marqueecontent
% F% h# |+ F) q* s' X! I- a0 Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% y. ~9 v; H { [# H}& {- C; w/ }! B/ ^; b r
else if (document.layers){
; v# }4 S w+ L$ `2 ^ns_marquee=document.ns_marquee.document.ns_marquee2# z# {- @9 ~" @5 L0 @3 I
ns_marquee.left=marqueewidth+8
4 A0 A: G' P0 {! dns_marquee.document.write(marqueecontent)1 Q9 }$ Y" R, `) W( Z& G
ns_marquee.document.close()
3 ~" m, |$ \+ y, B" f$ R2 cactualwidth=ns_marquee.document.width- R0 q- ?7 V4 g) k+ n' \3 r1 Z
}
! f" k! W! c! e2 T- L3 M0 {lefttime=setInterval("scrollmarquee()",20)
- [- P* F) I$ F2 \ j5 m}
+ L! _) o* u( x/ r" dwindow.onload=populate3 F! _+ f2 A: O1 ^. f1 X
/ C- W3 F. ^5 }9 P1 Kfunction scrollmarquee(){
& x% H% s1 @+ ]9 ]! v) O9 F( Sif (iedom){
2 f1 i9 `' R1 g0 s+ U0 Dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); s2 t1 j5 t% U- A: B: R; L" |
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& o3 g3 k$ W. M7 O6 k3 t* s! R
else
& _3 I2 B, i9 jcross_marquee.style.left=marqueewidth+81 _: c( h+ K: b
1 a+ ` i: o+ G9 ?, d" m. I9 `1 I( m
}
% i) w5 y0 E. i4 m' t2 Felse if (document.layers){
4 M+ O/ I, a; Rif (ns_marquee.left>(actualwidth*(-1)+8))7 N6 P& j# _7 s
ns_marquee.left-=copyspeed; n" p1 s8 V, r8 n* ?3 a
else
* o! A- c6 L7 a# L+ _7 F3 M3 zns_marquee.left=marqueewidth+8# P0 u7 ~5 f' ^
}( ?$ ^7 G" {+ X! \6 Y* g
}
1 D% m3 | r' d, d0 d$ ] D& Q4 `& B8 M1 i% v/ X
if (iedom||document.layers){
. k. n5 K$ y0 t4 Y0 y5 {with (document){! U0 W% _! p! V2 d
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! D& n# \! `" C& X8 fif (iedom){4 Y% M G$ z. U
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ w( L. ^& e- F/ i, z# G+ lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 Q' c& A+ W' u4 U' [write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 X2 h5 p$ A- F6 qwrite('</div>')! K! |' w8 j2 r7 R
}
' w/ @' C# Z5 \/ @- M# Kelse if (document.layers){! _$ H1 r$ ]* s% s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 }6 o, p7 y/ C! d) r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& b7 j% u' E. u3 J7 T$ o
write('</ilayer>') b3 {: W7 E/ R' w
}
5 q( \% k. s$ R7 N, m" d- Z, N0 ndocument.write('</td></table>')
4 L7 L4 G% c: C: c+ n: N) @4 {/ S}8 G* _+ y U: ]. L S, N/ g
}: v& q6 V! N7 ^, j- `4 J* J' O; {
</script> |
|