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

|
网页之跑马灯文字特效
//修改宽度
% _$ s4 N6 a3 E, G' Hvar marqueewidth=300# S" R# [5 e, v1 |- l
//高度
6 r$ x8 G% G0 O0 C, S% gvar marqueeheight=25; {! o& {+ _. B3 j( K6 ]
//速度(1-10)6 h m" f" W& z3 T5 i
var marqueespeed=3
* N5 @1 k9 _5 i% \6 A//背景颜色/ G. A2 ?- ]& P% O
var marqueebgcolor="#FFFFFF"5 r2 f! K4 B0 n4 A" i" z
//是否能暂停 (0=no. 1=yes)?: z) f- c) R0 ?* e2 l" }- e
var pauseit=1
; `$ l" y. T* E. \6 O
0 Q" G6 P; m: W$ @' Y+ G//修改显示内容3 C& i) {7 d3 F9 n
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# g# Y6 Z5 V+ |9 u: k- x
( i6 i8 K4 x, T; p; _2 q+ t- R( i5 ~- f# i0 H* ], Y; v5 W" |
////下面不需改变////////////
" u" H* ]5 ^1 j# A% l4 E% P3 b" ?$ o. L* W
var copyspeed=marqueespeed# j& s: K7 Z8 }/ T2 A ^6 u
var pausespeed=(pauseit==0)? copyspeed: 0
6 Z" ^, s) S7 P& g- X2 [var iedom=document.all||document.getElementById
H7 q4 c& B' ^* [if (iedom)$ v% x& P4 X4 `1 [
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; T! Q& z8 q' ? {! E: {var actualwidth=''6 v! d& c& z5 _ s3 ~- Z
var cross_marquee, ns_marquee
0 M* V7 V& o0 Y" h: z* H# k @: D0 e/ v9 H6 v- d% g
function populate(){
' m8 T+ C8 f* j/ ^& o8 O0 e5 Q7 q- B# @if (iedom){7 T5 a. i9 q, f0 @$ D% m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ \; C. y, @1 O5 x' t; N# k
cross_marquee.style.left=marqueewidth+8
7 R& @; a( ^+ ?7 O7 Zcross_marquee.innerHTML=marqueecontent
2 q# Q p( E2 \# a' Z9 Dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& z; d! V& j' }}# f {' v7 ^6 e* ], l' N! _
else if (document.layers){
& c1 G$ H' F0 q4 ?* q7 E4 jns_marquee=document.ns_marquee.document.ns_marquee2
8 B- Q: A& \) |! H3 M% |ns_marquee.left=marqueewidth+88 F% Q& t/ y' k6 A( a
ns_marquee.document.write(marqueecontent) b: w0 l; v+ r6 r
ns_marquee.document.close()
6 q& X$ ^9 {9 Xactualwidth=ns_marquee.document.width
$ A4 `# [) K7 D9 P$ L}0 @" }' C; ?$ w; n8 Q, Q" o
lefttime=setInterval("scrollmarquee()",20)* Z" {$ I9 Q$ L
}3 N3 Y0 q' O/ p
window.onload=populate3 ~. N: Z& a h, y7 E# P
K6 g1 |( d. E: T4 o+ }
function scrollmarquee(){
" F- d0 h7 { |( p; R6 T$ \if (iedom){% M9 U9 ^6 g& g+ F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" C; x: \$ k9 o4 d& t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 a& n/ n" c$ U* Eelse
, G, f1 x5 D# \8 E# Q" V, b6 Across_marquee.style.left=marqueewidth+8
- p: @5 F0 G9 J3 G* c
9 P6 K- \' Q: v. G- [" n} _! \: H1 N5 Z0 Z3 H1 M9 `8 y* S
else if (document.layers){
0 Q! m" a' V( L* L! D Jif (ns_marquee.left>(actualwidth*(-1)+8))0 B& [# G/ R/ g
ns_marquee.left-=copyspeed
4 b& N; h7 N) H2 j6 t2 Delse+ F4 H! I/ u$ u3 g
ns_marquee.left=marqueewidth+8! O1 u$ _/ `/ y' G& d5 t! @7 g/ l
}
8 M9 R9 Z; {1 |}' ]' |( c, O( L% l4 d% P- ?' ]
0 p6 O f) I) @7 `& `% U$ d2 vif (iedom||document.layers){
- b' F% k4 T8 Y# B4 uwith (document){+ F8 M' ^7 Z3 H# Z3 ^0 }! j0 W/ r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) Q r# ~" e% n9 C( L3 U+ }if (iedom){/ u0 D0 t( `7 O0 Z( w5 r' {
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& @$ ~* R( E1 D+ V0 ]: ^! |write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 d4 R! I5 g; C& z: r
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 Z" u9 ] k1 @' ^: {write('</div>')4 b* G1 [4 w7 v7 n9 E+ A4 j( D
}4 U+ I/ V' e* Y1 f/ v7 H
else if (document.layers){* C8 g$ \7 f, v+ |: _
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): E" j7 ?; C; z" J
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 y% A- D+ f2 w8 ~/ b
write('</ilayer>')
+ |6 e) P+ P1 R; p$ N% Y}1 L$ I* N6 Y3 _1 b o0 ?
document.write('</td></table>')/ d5 @0 b* K0 f2 G5 p1 u, q
}
5 U* V) x6 I2 \( K; b7 Q2 R! m}
) V1 ^' q1 z4 ]0 Y" h2 x</script> |
|