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

|
网页之跑马灯文字特效
//修改宽度
7 ?3 N! V& B. @ U9 C4 J. Uvar marqueewidth=3004 E# P2 s$ ?: V$ T$ _$ d6 @
//高度
9 L) w: [$ Q. ?3 E( cvar marqueeheight=250 K# f$ F( t1 t6 P0 u- S
//速度(1-10)
% c, p- y8 ^% g# avar marqueespeed=3( C) `# o3 c* `0 D! l" G- n: e
//背景颜色2 N, ~/ Y5 [, t+ v% f! a
var marqueebgcolor="#FFFFFF"
- L$ O; T8 H) G- }8 X% O) U+ g1 y+ @* V//是否能暂停 (0=no. 1=yes)?
* B, ]; Z# h+ N9 ?8 F5 K6 m3 A xvar pauseit=12 x# Z1 K) v1 O$ s% G1 G* ]0 u9 W
I6 x2 b8 m5 A) `. v, T* z) P8 O+ l3 _//修改显示内容
% o/ D5 }9 F. w- @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 |5 K' `2 \% f5 J( _ d
/ `* n: |* ?1 u3 ~: B5 Z. K4 l* F. @' v7 `& C# U& v
////下面不需改变////////////: p& D* u" v- [2 b1 x& V% j/ F/ C
" O$ i, u1 A; R
var copyspeed=marqueespeed& B: L' ^ `3 ]9 O
var pausespeed=(pauseit==0)? copyspeed: 0
; H( j. _9 F8 h. o% y1 i! I6 e# Wvar iedom=document.all||document.getElementById
, @" Z( u) p @% c" fif (iedom)
O% p9 }8 a3 i! F6 ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* ]+ [1 d$ Q1 B* r; x7 Y$ E6 N
var actualwidth=''
% r- C- P8 s9 ~2 \$ mvar cross_marquee, ns_marquee
: {# C1 W# g, w4 e5 M% d1 I. P- |4 q6 ^6 Y! F5 L0 l
function populate(){
4 \0 S5 G; e [2 K$ ]( Q" xif (iedom){
5 W# L: r [+ W9 b. V4 ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( i7 B$ M! q* [7 v! }2 W* b j0 A
cross_marquee.style.left=marqueewidth+8
% S2 U; w) O8 G2 mcross_marquee.innerHTML=marqueecontent
; M) ~7 @: a) R* b: y7 `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 c5 c6 ^$ `8 o# B; @}- C9 D$ r8 e3 E0 R4 a; \
else if (document.layers){
- ^- `8 Z& z* t! b3 o: G* vns_marquee=document.ns_marquee.document.ns_marquee2
9 p4 a: f2 z$ pns_marquee.left=marqueewidth+8& }7 _( C5 \3 l3 K* P# W
ns_marquee.document.write(marqueecontent)6 E7 U+ Y1 @$ d! w
ns_marquee.document.close(): \' b: @ N( r! d
actualwidth=ns_marquee.document.width, @$ n, _/ k/ W+ @. m
}
. \7 L" V" g/ x9 \" u5 }lefttime=setInterval("scrollmarquee()",20)6 }, y6 ]% w* n O. `, A
}& P+ K0 [0 j& _$ o5 P! Y1 A
window.onload=populate- ?; m$ Y5 }* X) f1 t5 C
, z6 _- V( Q* c& V% x" `% d( Y
function scrollmarquee(){/ z1 W9 A, d+ H7 N( S
if (iedom){
4 B/ E/ g8 s0 Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 u5 d5 E5 y7 z* C4 F2 T. H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) y' s5 N M- r6 a; \else
4 F( g& s- x) J2 h' ~% }3 C1 ~: l! Ucross_marquee.style.left=marqueewidth+8" n _0 n4 s5 e+ a* B3 R4 d
. g1 L, V% o' }4 ^ p( h$ k' I}, s$ ]. a X9 l" ^0 S5 T+ \- D" q
else if (document.layers){$ k+ @5 o. t: [9 c z4 D3 e1 ~
if (ns_marquee.left>(actualwidth*(-1)+8))6 W' c* h: i& T/ s9 R2 N
ns_marquee.left-=copyspeed. W4 p q! Z+ O; ]# L
else9 e% @0 h7 F6 n. x8 t
ns_marquee.left=marqueewidth+85 H& j3 s% @ v0 I' }
}
2 X$ R* Y) J# A+ d( t L1 S}
- y/ V' ^( k5 M- z" ~& Q1 g) B1 o0 S, F* L0 R3 r, b( d
if (iedom||document.layers){ H" p4 a c( G2 q0 r- v/ \
with (document){
9 n; k7 ^3 I( Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 \! l- h7 \) T3 H! `5 o
if (iedom){
) |. ^1 q* e5 S) |1 c2 O4 B* uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). Q; E& }) ^9 |8 {
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% x5 x. l( h# n; v; l# N/ R
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) Y6 p" H6 y( r- ?: @; `1 I4 `! P
write('</div>')& ?) @0 e- T: i3 B: H) @; H
}( w, B+ `) i: ^- F* A
else if (document.layers){" ~3 \0 m. Q, C/ j" }
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 b: z1 _: O) Y$ dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 Z5 W* o, x" z r, K
write('</ilayer>')
+ w" r( X' ?$ ?7 p. u9 p}0 a2 p! T7 K' V9 d9 J# g
document.write('</td></table>')
7 W. K' V. ] m' `- v}9 \# |; ]6 `3 a0 j% C
}7 |. |/ f1 f7 C) w' r, v+ m6 N. \
</script> |
|