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

|
网页之跑马灯文字特效
//修改宽度
( n2 ~$ ^+ K/ _) q( }# @. H- qvar marqueewidth=300
* Z; t3 e7 K/ z$ o6 N! a9 k//高度; G# X: h# L" [7 h7 j
var marqueeheight=25
# S* b9 \8 k4 \/ F* ?//速度(1-10)/ w# I& E; W" U; @8 J& Q
var marqueespeed=3 Q$ x) k' b$ E, K; M r
//背景颜色3 q' F f6 h& `- m. p
var marqueebgcolor="#FFFFFF"
) q2 L% u; r9 h0 T% `4 Z8 q) i# X//是否能暂停 (0=no. 1=yes)?
( I( z+ U! k) l+ v9 ?var pauseit=1
9 _9 w: r& a9 n* }2 h7 `9 [( S7 Q1 h+ i" R- F! H
//修改显示内容
: Y+ a/ S8 ], C. R' T& @0 \8 Pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 t" R( Z" T& w/ h Q8 O
- [: K/ K; X X4 t( V9 x: t
5 B, ^; f2 q8 n! P! ?" `9 p////下面不需改变//////////// u+ N( e+ k8 F
- @/ X! [6 |" \$ M8 @7 ~var copyspeed=marqueespeed
* K( f# F* U5 Z( {2 @- Qvar pausespeed=(pauseit==0)? copyspeed: 0, ~5 V6 D6 Y0 T+ j7 u) O
var iedom=document.all||document.getElementById
6 Y; h: z' G8 y' f2 e3 ]if (iedom)% `# U: W7 ^7 T$ o7 z! V! c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* O3 q( ?; Q2 F9 Jvar actualwidth=''
# U c7 |8 B2 t {( w) `6 Q) u$ p* W, Hvar cross_marquee, ns_marquee
( u! A: P* `% o2 `. L* Y# X
& X# k8 ?. s% T6 A* {: Gfunction populate(){% f5 h" p: D5 c n- M! n' I$ J
if (iedom){
' J' G, d( {1 c' K5 S6 o, A' C; g) Hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- R7 f2 d5 I) _. V: Ecross_marquee.style.left=marqueewidth+8
) n( A* {0 V" R% F$ zcross_marquee.innerHTML=marqueecontent# A/ O' V; [- L
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 ^1 x! ~9 |; w) H3 c$ E
}7 ? V' D: m( n" N# k4 l# t; p/ J
else if (document.layers){; C: K2 i& _4 T- O7 {# M
ns_marquee=document.ns_marquee.document.ns_marquee2' e- `) Z) ^, y1 |9 @! [# |8 w
ns_marquee.left=marqueewidth+8
$ D$ ] a/ e: i% Xns_marquee.document.write(marqueecontent)
9 G5 y1 E) H# L7 E+ Hns_marquee.document.close()0 L3 c1 R0 O2 w
actualwidth=ns_marquee.document.width! u6 ]& ?$ ?& E7 E+ x
}
! @5 p2 b: n+ ]' }lefttime=setInterval("scrollmarquee()",20)6 d5 m, V: J- e0 p/ T3 I* k5 p
}. d/ p; A/ f' P5 [
window.onload=populate3 z( A @" B n+ v6 n! x2 `+ }
0 b3 w) |! p2 o% q) F1 [+ x) o' R
function scrollmarquee(){
( P1 q# C& y# t. X4 hif (iedom){0 D) e( L- w: o' S+ {4 D
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 Q' C4 e$ L: O6 U8 _- n" l3 m: g" ]cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 J, D. Z/ M2 v. |else
, c' c( z8 `( z! W. x8 g2 zcross_marquee.style.left=marqueewidth+8! Y! T: U3 n5 k: p
1 }& n- n: m B9 j" S}
3 m p" I: Q8 Y$ [$ j# d5 Helse if (document.layers){! b# z3 Z: z1 {. J- x* S
if (ns_marquee.left>(actualwidth*(-1)+8)), e* M# q* V/ Z! Y
ns_marquee.left-=copyspeed! ?) P! w: M. }: a1 t+ G
else
# W @/ d5 ]7 M, S) j' dns_marquee.left=marqueewidth+8
; Z! q9 N# j z( B}
* j% J+ `8 E0 `" P* i4 @% x- U}
( K8 y }9 ?" ~- ]' E8 e$ y" n, B& A; k! O
if (iedom||document.layers){
% u. U T/ i8 B( Ewith (document){5 {1 ^' U" S' W2 f) d R
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 T/ v& j9 e( S# K; V0 h# ]7 Q% ]if (iedom){
( |% S/ u# L l, [& k( swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, ], T E/ F2 W! l( y( awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 D% l* B3 R: [# v, G( Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 A' z, B7 X' swrite('</div>')
0 w; O$ U6 `; r& i) U3 i}
. ?1 l3 C4 N( s* O( h& J5 celse if (document.layers){
. L" a1 m1 V7 E" @! l& B9 ]# L( Y/ ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 U& i! t% ^; g/ u2 b% ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" r' F% U4 p- \5 @7 z
write('</ilayer>')
5 @5 x, e6 n# h: X% W}3 w4 f0 j& ]& L% B/ @1 l a
document.write('</td></table>')+ e( L4 V3 k" S
}
/ i; I1 d B- E1 i}) n# T3 x2 A; q6 g
</script> |
|