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

|
网页之跑马灯文字特效
//修改宽度
4 V8 B% }6 U& z( kvar marqueewidth=3000 ?2 Z; x' Y% x, H h
//高度4 `, x a+ m x! I9 u
var marqueeheight=25
: q: C C; |/ } ?3 a//速度(1-10)2 p* I; P0 Q& L
var marqueespeed=3* V* {- V$ A9 ]5 b
//背景颜色
, ?* t6 q: L) |. _! Z( O$ V) lvar marqueebgcolor="#FFFFFF"8 n& u$ [/ e5 g; o8 q# F
//是否能暂停 (0=no. 1=yes)?! U8 z% g+ p7 A5 L
var pauseit=1
# V" A( |, w; B) q6 @7 ^
( E* F/ y) p- K6 L//修改显示内容3 L* Z: r7 D: x" ]+ a
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 v2 e1 q) z1 c( u; p8 ]- N
1 j J* d. q# f' z' p3 r: `
9 F5 c0 E ] W////下面不需改变////////////6 V0 T; ?; Z$ g! d# C( L
/ C" e2 N- y; g5 A: }" w' S
var copyspeed=marqueespeed9 \. P g4 o& x1 c# X, S& e" D+ ^
var pausespeed=(pauseit==0)? copyspeed: 0
6 c8 s% G- Q2 `; ovar iedom=document.all||document.getElementById
" B4 X: i5 F& ]7 S& \3 hif (iedom)
2 h f$ o) {$ o x5 a/ T. y( q. ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 q4 z2 b, r2 ^# |; p9 Y8 `
var actualwidth=''
B. T. [- f3 j( \: g k, S) A2 |var cross_marquee, ns_marquee
5 I+ |/ Y# Z2 x" u' l# G" i8 g1 _* }' q% g3 I7 l& }
function populate(){) G. O. {8 K0 ^4 D2 [) S A
if (iedom){
2 L6 ?. `& J) K+ L! O6 ^2 y4 ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. v; w+ |! L& w) a. ]
cross_marquee.style.left=marqueewidth+8
% e) ?# x! v4 c: m: J6 ycross_marquee.innerHTML=marqueecontent
; r6 @+ d8 i" }) T" B0 eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 m& l/ X' C$ U
}. G% i8 g; u7 W4 M% q, m" R
else if (document.layers){
1 U! v2 u: g3 O1 H3 ^1 i% Qns_marquee=document.ns_marquee.document.ns_marquee2& q1 y+ {+ `& w e0 |& A* t+ I
ns_marquee.left=marqueewidth+81 N$ W& q6 g, l ?' J- r E: Z
ns_marquee.document.write(marqueecontent)* h9 D( Z8 C! ^" a8 s q* T# g2 T# p
ns_marquee.document.close()% s6 x* V) K- y# X/ U9 f0 t _
actualwidth=ns_marquee.document.width
& o7 H. p( _$ _: ` x. m}* g6 R2 C3 p$ O4 P# N, `
lefttime=setInterval("scrollmarquee()",20)8 j, f1 Z$ @ M3 |/ Y [% a
}
) C0 t- t& c: s% C9 }window.onload=populate+ k7 t7 _+ l8 w. j: `: Z. j! |- ~8 Q
0 O' |' Q8 _0 s2 t* O! \function scrollmarquee(){
# p0 p, O' [9 s' n/ F" iif (iedom){
5 B4 R" C3 E. ^1 ] V4 sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 }3 I7 H. X* N' V8 w' ~/ i
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 r3 ?1 B5 W5 ^( |3 L$ @9 M B
else
H9 U. B' {) f- }! c; Ncross_marquee.style.left=marqueewidth+8
. o2 j- M0 ^$ z% M. d5 z ?0 C: P) ?1 z7 U% D% W7 ]" I
}. y/ [5 y6 g. {' |" n) B- f& X( d
else if (document.layers){
- i' x% k8 J2 Dif (ns_marquee.left>(actualwidth*(-1)+8))
. R( C( ?. K3 U) x$ E* u& @/ I6 uns_marquee.left-=copyspeed
2 [ y, P7 x8 e6 p4 telse2 E" T( t: D+ t
ns_marquee.left=marqueewidth+8
8 b/ I$ l& G1 ^: q7 ?) C}
4 q2 V: x5 S3 Z+ |, h. ]! s. z' N+ ~} F0 ]" C. r8 c& [8 d
! ], E* o1 p1 ^/ I* uif (iedom||document.layers){" Q8 ~0 o; k- ~* D4 q( n- y
with (document){
7 ^! {9 L3 c! m* `. [3 w+ p4 pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" \, _6 h: x/ {3 q# H( Aif (iedom){
{+ L9 d+ ^5 A1 Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- \* h: I% ^- `' e; e% h( i! s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ \1 p1 _! _" ]' s6 [8 rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 k$ B$ n$ [+ u0 ^ Vwrite('</div>')
( K. W K' C( Z& _3 d}) W9 z+ u4 k N* I. |2 x
else if (document.layers){
0 P* q/ U0 s# M3 Iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 M& F5 ~( g1 x l8 g3 Mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 D% {3 v2 Y! }, Cwrite('</ilayer>')4 d3 O& q& w* v3 W# J2 D
}
! C O$ x, E6 ?' _+ s# G! `document.write('</td></table>')1 S3 _3 ^5 b( W+ Y# ^* T2 k; m
}9 y. t3 t! _0 |, E: [
}
6 O! s* x. j! }" t8 ]$ @</script> |
|