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

|
网页之跑马灯文字特效
//修改宽度; Y% t3 L# q- x' z
var marqueewidth=3005 ~0 F2 z0 H2 ^: f0 r3 S( t3 u {
//高度
: B% j% j; U P' {8 S3 zvar marqueeheight=25& M# O/ x4 e; L3 b+ @- G
//速度(1-10)
5 S0 z5 W! p5 g: N% ]var marqueespeed=32 y! \+ N% B$ M3 A
//背景颜色5 _ `' q' h/ M0 K# |
var marqueebgcolor="#FFFFFF"
1 q- E; [; r5 V, e/ U//是否能暂停 (0=no. 1=yes)?
' v S ^- D. M8 D$ zvar pauseit=1- H" m, @- Y: T# C6 E: N0 Q
9 J8 T' m3 a1 Y5 h* S//修改显示内容
5 E& {! U; D# y. C1 w4 E, {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( p; o2 T* n" O" ?' g, g) w
9 P. d1 L. Q2 ~; a4 c" I
+ s, Y% q( L' D6 J! ^; O. u////下面不需改变////////////) y" ?2 l# Z4 _+ a4 T& c' I
0 [( s$ k3 h, n) cvar copyspeed=marqueespeed
% t q) t9 k. g! k, P: d" i9 xvar pausespeed=(pauseit==0)? copyspeed: 0# V. A# J, z, K1 o( ^
var iedom=document.all||document.getElementById& V/ Y3 A2 u' I: B
if (iedom)
7 {5 E( M- M( g$ jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# @5 I) k* W9 ? A
var actualwidth=''
v* H, `) w3 b2 ]var cross_marquee, ns_marquee
6 v; G: k! T/ \! \+ O, D& a B1 q$ V; J. x) |0 g' W% B: @, F
function populate(){& l$ ^0 k1 e4 I0 Y, H( V f; |
if (iedom){
1 f/ m" p* @2 Ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 m6 n9 ? k8 t. across_marquee.style.left=marqueewidth+8
1 q% t3 J. s/ `; _. z' R% V0 zcross_marquee.innerHTML=marqueecontent
* I, T. G) T% y# c$ {& tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 G8 R1 J o7 F, Y* M% D}2 J$ E) B. x/ A/ o j/ O
else if (document.layers){
! Z! D! [1 e+ j' v2 c9 `ns_marquee=document.ns_marquee.document.ns_marquee2/ K! k! T* J2 Y& M
ns_marquee.left=marqueewidth+8
7 _$ H1 \- b# n% x% G- C% ?ns_marquee.document.write(marqueecontent)
/ k4 G& J) v6 M! D I a3 h: Wns_marquee.document.close(): ?( {/ d. ~7 z, m
actualwidth=ns_marquee.document.width
2 z. [3 f5 C6 Q) w7 O( m' \}7 Y: g- } g4 Q# x
lefttime=setInterval("scrollmarquee()",20)& _; A( H0 ?, ~$ b: e
}
% Z* @# c: `: cwindow.onload=populate1 O7 M, U1 _3 [0 `/ h7 j; ^( }
3 L7 F% I8 N% t4 h6 q
function scrollmarquee(){
7 b! G: l* @# ]3 V- [if (iedom){
; }. C9 V% ^, ^& Zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 { x' O7 g* a" ]$ ?$ u @! Hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ N, k; G6 G E3 [: [2 T. velse" p a) N `3 |+ A( b. w
cross_marquee.style.left=marqueewidth+8- F! T4 T3 k: e0 ~" i
1 @1 ?- H5 z- }- }9 s! T
}
z% \8 \4 d! R6 yelse if (document.layers){
4 w( |( F# y# t) e3 z. Aif (ns_marquee.left>(actualwidth*(-1)+8))
9 ^$ U8 g8 v/ V1 r- wns_marquee.left-=copyspeed$ ]: P" j0 |& M" A- W+ }- c4 W
else! ?' t2 i! d. K. _9 U( ^2 J
ns_marquee.left=marqueewidth+8
* r& K p% C2 @}
. s( p5 j: W/ J% C$ w4 e}
0 x" R# `/ D7 ^# u' Y
6 ~5 c$ G* a8 `8 Sif (iedom||document.layers){0 f5 F3 r) J6 ]1 @
with (document){& v. I6 U, J9 f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 F% _, B2 C' y) K+ \. ^& p
if (iedom){4 W1 [$ l' ~4 B1 M( G( S
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% \3 T2 j' y: P0 u( H7 \
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 q, F7 ~& k5 O8 _, d3 m7 `write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 B7 k2 @% Z2 L3 e, l9 Q* y. U; Bwrite('</div>')
L7 \6 ] f/ U+ ?4 G% _" c1 _}
- G# o0 X: }- k( c, f! o& h Belse if (document.layers){
$ y# n: l0 B, l# d/ }& w" \7 V3 cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 T. E6 Z. B1 Z8 k0 [, T
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 i6 H0 Q3 p7 j# y
write('</ilayer>')
4 r" o3 C/ m3 P1 q& p$ L}
! D8 u$ G1 _, J0 x3 |document.write('</td></table>')2 y' F/ Y; s i/ ~5 u1 p- s n
}
5 Z! m9 ]8 `# y# Y8 x}! L$ T' b( h5 r U
</script> |
|