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

|
网页之跑马灯文字特效
//修改宽度
7 w! s; F9 `; }var marqueewidth=300: W$ f7 i7 q5 d5 Y+ g& N7 C8 h
//高度3 u2 E$ _, @+ d/ |; f: N
var marqueeheight=253 H0 t2 m. M8 o7 y6 W! L" S
//速度(1-10)
* E% Z" v* {) N2 f7 M+ l4 K }var marqueespeed=3
+ J. y% |1 T' y p8 U//背景颜色
; x5 H$ @9 L, l+ pvar marqueebgcolor="#FFFFFF"
0 c7 T+ S" _* e: P+ Q+ d//是否能暂停 (0=no. 1=yes)?
2 S. w. P( |* ^0 O+ G" ?var pauseit=1
1 Y9 L* \) I) r2 o: Q4 A# [( F1 {( {' z! X: J3 O( L
//修改显示内容2 G5 {1 O3 h# ~6 k) g
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 S$ m' |, |$ e; M v& \
! I7 G7 y# }# P2 r, n
; p2 S8 r# n8 e! ]' u# V' t////下面不需改变////////////
+ x/ R' v, l" v- Q9 I9 c. X v, ]
var copyspeed=marqueespeed
" X4 Z1 ~3 r4 U6 _) N, q, Ovar pausespeed=(pauseit==0)? copyspeed: 06 s+ T2 a: S4 F: F
var iedom=document.all||document.getElementById
$ z; h* I! F/ ]# }* t* j0 T" Oif (iedom)
# l2 |4 n3 w* _! K- P, Z- ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 O, W! }' ]; bvar actualwidth=''' W& w+ g7 W4 f1 R% S9 o
var cross_marquee, ns_marquee
$ c# E' Y" K% S- t- |+ v4 \( J
7 }' x6 d: R" }1 [function populate(){
) R& Y4 z* o7 R% [( Dif (iedom){
2 L. c% _! w0 \& wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# `; t, r1 g2 w) R$ i, J, [
cross_marquee.style.left=marqueewidth+8$ q! x7 X [8 I$ m% L" E9 E$ W5 ?3 K
cross_marquee.innerHTML=marqueecontent
( M' i |0 h% |- Pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- P5 P/ w% l0 _' d0 u
} o6 k; A% B( U5 b4 z" U0 v2 e2 u
else if (document.layers){! q: s& S( Z$ x$ C
ns_marquee=document.ns_marquee.document.ns_marquee2
; e9 K9 p% x( l4 p0 ^4 sns_marquee.left=marqueewidth+86 t$ U; ~0 ^& L) ~( s" j" H
ns_marquee.document.write(marqueecontent)
5 t: Z0 c! u$ N/ |; q' W8 yns_marquee.document.close()2 ^4 {9 U. v" b7 A' w
actualwidth=ns_marquee.document.width
6 P7 x, f( I$ [- x: B) X/ m}% R7 _2 w( Q$ J2 o' J
lefttime=setInterval("scrollmarquee()",20)( K0 ?) j" ]9 s Q% k! [
}
4 o" U: F) ]& Jwindow.onload=populate% ?6 ]' t& R7 ]
4 @8 V4 A; X0 |1 t7 Gfunction scrollmarquee(){
/ h* K$ R8 p7 g7 oif (iedom){
( }5 c6 a& {7 G& M4 g( T( ^if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), @' U' u* a( j3 L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ `2 `4 _, R I6 Y' V9 k/ delse. R+ I( k+ N2 |
cross_marquee.style.left=marqueewidth+8
1 E9 O# c+ X% ]5 `: k
5 d. w" k& x. D; N9 W' b( h! I& T4 L}
}7 c N6 F, R* E0 Z" h ~0 zelse if (document.layers){1 q4 @3 M9 E3 t" g# E
if (ns_marquee.left>(actualwidth*(-1)+8))1 E" s+ J8 P' a, A( V7 Q
ns_marquee.left-=copyspeed5 h$ `3 M, T2 L7 @$ X6 O
else
, |. r5 f# _7 I, s, |5 {1 qns_marquee.left=marqueewidth+8" z+ z1 _! F/ ~( Z7 y9 ]" d* ~
}/ w. p* |# i+ }# z8 A. I
}2 @9 U8 \9 L& y; b1 m) S7 u
8 q' z5 x% F9 S; T3 A1 b; iif (iedom||document.layers){8 V, u: h/ @. M9 a; m' r
with (document){
1 I2 _2 N* c7 f' tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 g( g" G. [ A) ]. dif (iedom){
; Z( V9 J6 D4 d0 k! X/ C$ Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 D- ?# L# Q: E+ h
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 e# e$ U/ `& ^6 A% M" r( g! dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! R; F5 O- U, z" `3 Q" G
write('</div>')
( A A' p/ C( ^- k) \}
1 n9 P9 g6 n( c+ L* delse if (document.layers){
8 w3 A& i3 [! jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) K% k$ g/ ~9 g4 w4 L8 V! U; `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 h+ n8 s( J9 F3 |- }2 x% k1 k# Ewrite('</ilayer>')6 `( c4 w J! ?& `
}
]1 ^5 n2 S) O. K) c5 Sdocument.write('</td></table>')
9 b9 F% S+ n) c. F3 ^}
4 Y! ?% x- }# E. ]1 q* F# j, U. c}
8 J" T/ b" a, d% n; z</script> |
|