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

|
网页之跑马灯文字特效
//修改宽度
6 D' Y" O, m4 \( n8 Q8 ^var marqueewidth=300
1 S' k* k3 D8 H5 J4 }* E//高度1 t8 Y$ M+ E7 f" z7 J: H6 Z
var marqueeheight=25! `! ^' U# b2 j% w( e& D% ^& B
//速度(1-10)
! R( U7 y+ G) c, lvar marqueespeed=30 {! W- V" ^9 x1 J2 n2 B/ e: c- }9 n
//背景颜色. z _0 U; d* A
var marqueebgcolor="#FFFFFF"# O! Z/ H9 r {1 U. P! n! }
//是否能暂停 (0=no. 1=yes)?
( [% q9 M% Q, U1 t/ Pvar pauseit=16 T# q' z I2 ^. l8 i. o
) t( ^$ L6 J9 a1 W
//修改显示内容* E/ D( ]) r7 y' D7 K- h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ s' P5 M; ^- `% y
F) I0 a2 b6 L( K% E6 V2 m4 e. v1 J; Y* s {8 K2 O! U
////下面不需改变////////////
* E0 s2 z' L+ M# q8 g
8 G+ [+ P8 I* s; |! `8 mvar copyspeed=marqueespeed0 R: D! c. S" ]7 H# W# y) J3 v3 u
var pausespeed=(pauseit==0)? copyspeed: 05 b& Z$ E' e: l/ T% _
var iedom=document.all||document.getElementById: O6 e. F" H0 Y% o r. t3 y
if (iedom)3 J3 t. a% D5 B; p4 r5 d# w/ d
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" i8 Y6 D' c& F" O" M
var actualwidth=''; j1 Z) K& v; R3 w( F- n% }6 _
var cross_marquee, ns_marquee
+ H# m" y9 P. u$ u3 W8 J T+ l1 y4 ^4 ?1 j
function populate(){
- O" Q: @2 Y" U! Y! O0 K( y4 tif (iedom){
! `9 E. H& b8 l! |cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! V3 r) i: V$ L7 Y4 \) p
cross_marquee.style.left=marqueewidth+8
1 H4 T2 [ A. n7 {cross_marquee.innerHTML=marqueecontent
/ D: K* s: M& s, E' F( B6 Pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 q( y6 g. Q) L/ R/ J5 `3 A) K}* ?+ o+ Q! S( ?9 r! y1 x
else if (document.layers){
0 M/ v0 [ c3 Z: {ns_marquee=document.ns_marquee.document.ns_marquee2
; J/ R" i2 P# pns_marquee.left=marqueewidth+8
3 |9 F7 {1 Y% K& o* lns_marquee.document.write(marqueecontent)
6 W7 S" f, A- r( l' D5 zns_marquee.document.close()
. U# T) A0 z" Xactualwidth=ns_marquee.document.width
' L( w+ S6 T# D/ j}: ^ B, i& n2 {" T$ f% x- q$ ]
lefttime=setInterval("scrollmarquee()",20)
) x- [4 m8 }2 y0 y5 d}1 p$ k& @8 B3 r- u! v) d
window.onload=populate
: f# L3 G" A+ [6 `' a+ d
" P1 V; D7 V' n% i! ~! t/ P/ Sfunction scrollmarquee(){( ^ e$ o8 I3 x
if (iedom){+ n# _1 j4 u0 s5 Y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 I, o3 Y* l* V
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. B6 K- H, O" N5 M; a8 V! Y; d& b
else
2 N% E; Y6 c; O/ E7 x* tcross_marquee.style.left=marqueewidth+8
; d) d6 u' y* W1 u
$ A- @5 `1 }: p! Q) L1 _$ B* C}% i& s! _/ v [ b
else if (document.layers){1 J: w8 s5 }. j# E' S
if (ns_marquee.left>(actualwidth*(-1)+8))
8 O- l) w1 }0 [% A0 Dns_marquee.left-=copyspeed. q$ n2 U# o' p; G+ H, \6 X0 m F
else8 { |! t7 |2 [2 ^/ ]1 [, Q
ns_marquee.left=marqueewidth+8, A' @4 S( y$ B' H6 \2 C; Y
}7 S3 t: L3 k5 l
}, Y, s2 z9 x$ ~% E, l% t$ B8 d
$ ?0 P3 R @- q
if (iedom||document.layers){
- \) D. m* G9 f1 q) t. Pwith (document){
0 F* n* Y3 ~5 x* S6 W* |document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 b& O+ n8 r7 t# l; ]' I# h: G
if (iedom){! T/ O$ W! I5 Z4 O! g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# |& F9 g; V$ q1 ^0 f( |
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& F# ?7 T8 o5 `5 o. r4 F! d1 qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 y6 H1 u, A4 O7 @* W& rwrite('</div>')- J+ X7 ~% B2 [+ Y) O
}- C' x- j' C( y: y
else if (document.layers){
C4 t5 p& U% b6 J/ ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 u) H) C/ u) D; B
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 F! X+ O3 N% _+ W; P% `
write('</ilayer>')' f/ Z$ H! ]) k+ Z
}: M6 R% z4 q" J: v+ W; T
document.write('</td></table>'), t( w, N1 m8 c6 K; p& n. X
}
* j, d. L, b* z( k O}. G- u; b, }' y8 y6 M
</script> |
|