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

|
网页之跑马灯文字特效
//修改宽度
) Y2 R" o* }) nvar marqueewidth=300
6 h* ^4 D- A2 I//高度7 }; |/ K( z% ~) d! Q, R1 G7 s
var marqueeheight=25
" m% Q2 e- z9 C" Y" h- L0 h//速度(1-10)
7 P6 m3 l0 O9 o2 {8 Dvar marqueespeed=39 i. A, x: d. f; `$ M* I
//背景颜色 [0 r# ]. d$ u8 L4 _2 [
var marqueebgcolor="#FFFFFF"7 h8 H8 l+ B D M
//是否能暂停 (0=no. 1=yes)?( r( w, o6 v4 j
var pauseit=16 _) c3 k6 s2 v( ^4 N1 t9 g
6 k. p% `% E( L$ N//修改显示内容
" b' h8 K, J) y6 N, N' H$ xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& O8 [* Q2 D1 H. f0 K3 Y
0 n1 ? K5 p/ K6 m9 M, k
2 w1 j& F3 g/ e9 _$ B+ e7 g- x////下面不需改变////////////- s H; ]! {' f1 Y& N
, c( I$ c9 A6 u% Z3 ~6 |$ ovar copyspeed=marqueespeed
) T. D3 i/ ]: @; i S G9 ]/ Kvar pausespeed=(pauseit==0)? copyspeed: 0
! i) I' L" ~3 L8 A4 O3 Svar iedom=document.all||document.getElementById1 j/ ^6 U3 t& r) U9 F0 g& H
if (iedom)2 o3 B7 A: L1 t) ]
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ c9 @ Y O' p! Wvar actualwidth=''' l- |$ ?9 N8 d4 \5 T; v m
var cross_marquee, ns_marquee
" L, }8 V) R6 Y- w. | B
% _0 s- Y' w$ R( d; V6 k/ K& v. Nfunction populate(){
5 g0 `. u' U7 S* x; r2 Qif (iedom){: N6 B9 i! q6 R! G5 [
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; J ]' D* S7 s/ S* e
cross_marquee.style.left=marqueewidth+8/ D5 |. {$ z* r' r3 r' c8 S" `
cross_marquee.innerHTML=marqueecontent# u$ B& h2 ^' v2 o; j7 n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& h) d1 E8 r' }}
, e& C7 t8 y) t1 ]1 G5 helse if (document.layers){
2 F+ U9 ~+ A% C" Lns_marquee=document.ns_marquee.document.ns_marquee2
$ q: Y( r) m5 X3 z1 ons_marquee.left=marqueewidth+8
5 N+ U" f4 a! `ns_marquee.document.write(marqueecontent)
3 M3 Y1 c% }% W9 Dns_marquee.document.close()* ]- B k9 S# Q l
actualwidth=ns_marquee.document.width8 A2 h! U2 u$ p9 ~) n* O* E( g& K
}
{0 m$ y9 O9 v9 z8 _* R, h1 elefttime=setInterval("scrollmarquee()",20)! {" R. n/ v/ k2 o" x! h9 M
}* t0 [# C/ K) Y3 o- P* S* T
window.onload=populate
: K) }$ g6 a, M' S$ N2 v5 I( o
! g; E; J7 T2 }) M' q; Ffunction scrollmarquee(){1 d, x3 I5 L4 o) Z" z& T
if (iedom){
4 P& {" S& r1 N0 Y2 G7 mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. d, K/ F8 K- P- |; T* i, n# bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 t$ K" o# P2 G W0 `else
2 Q1 ]; N. H- v- U) H Gcross_marquee.style.left=marqueewidth+8
- B2 I' Y8 p) y4 S
: W% ]7 [8 P1 N. \* N, J3 r}
' s H3 o9 `( Y" N8 R+ [: T$ ]/ ~else if (document.layers){
- J& Y) D) Y! J: M1 o, V1 Yif (ns_marquee.left>(actualwidth*(-1)+8))
% `3 c/ ~# q( P2 n- y/ Y" Dns_marquee.left-=copyspeed
6 W3 ]: R4 a8 j2 F- G3 W1 o+ W8 d* Yelse
0 x, ^) d9 a6 W$ V' u+ W, ins_marquee.left=marqueewidth+8% R- x) `5 y9 d" q, E6 v
}( h, t" Z1 a, {
}
* d" Q3 ^6 K) o' \, D3 `. x1 z4 x0 D) O% E+ w V4 Z) m# f. p
if (iedom||document.layers){
) G, u( o4 e5 r1 T+ T; i$ N: `with (document){
* q' x% h* X' ~' c6 Y8 D. ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# A) [. f( l- s6 K8 O" @if (iedom){
& @9 z" U" q9 ?4 Q* gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 ?) [7 W* m+ o! S" ^: K! a' nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); |: `" B0 Y2 s' H
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 L7 ]2 ~' N2 ^ wwrite('</div>')
5 @$ t5 A, n- v3 p/ S9 X& C}
& X& X, F4 q% `else if (document.layers){
6 D: G* n3 n! S2 G0 p' [write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 V8 X7 Z' J) L& ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 ?, ]5 C u8 J/ h3 x: K
write('</ilayer>')
. k! ^# l1 V; L' t% s3 u- }}" I8 j6 e. n: x( N
document.write('</td></table>')
' }" v( V' T2 y9 g: w/ O% g- v}
3 J7 u- A" ~0 h}
0 O/ p6 I8 n- E+ e6 L/ ~8 h</script> |
|