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

|
网页之跑马灯文字特效
//修改宽度
3 j, D5 h0 f- i7 f/ \var marqueewidth=300, p- \) }! [( M8 c- O; s! F7 K+ N0 b
//高度' o1 f$ Z/ [" O% ?. E/ a8 Z
var marqueeheight=25
& L2 h3 _; y# a& H7 [//速度(1-10)
7 T$ W, I% C) I% Z# F/ o9 k2 Nvar marqueespeed=33 T9 W" E: f" T, J8 E
//背景颜色
8 M$ Y) L3 U0 N. ~var marqueebgcolor="#FFFFFF"
2 q5 L q# M, I//是否能暂停 (0=no. 1=yes)?
. D* Y; r$ L% C: q2 Mvar pauseit=1
5 u* O6 k3 U+ i# I: g. X) }/ P; U* E: k4 v- b+ j4 z7 m( p! @7 k
//修改显示内容
0 J5 v; K' Z! ]4 E7 K, r2 hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% i- m5 `) r% n/ _" S9 r
8 v/ f! v L1 ?
- w- c" S( c7 p& w V2 U& m4 E6 o////下面不需改变////////////7 {# B- c; J9 R* [/ u
F) L2 A8 }% {& n ]* l% `
var copyspeed=marqueespeed9 Q. u3 F9 ^# }: @2 r0 W* Y4 Q
var pausespeed=(pauseit==0)? copyspeed: 0' j0 _% V* i4 f$ \
var iedom=document.all||document.getElementById
$ S$ ~4 I* R0 ^$ n P4 Q$ ~if (iedom)
6 M- Q, Y; `4 B. k8 Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 I6 ]' i! a: p1 O9 d! f
var actualwidth=''
) S# z4 q$ g n8 _! H" uvar cross_marquee, ns_marquee# |; [% m+ v; i: U1 s; c/ r! J! ^) s
3 I/ X3 w" K' S% a. \$ t1 W6 {
function populate(){
' G9 b8 C( j" ^3 w4 Zif (iedom){
! @ o7 Q* h0 T0 f5 ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' X6 l4 @% r) S1 @
cross_marquee.style.left=marqueewidth+8: F2 X" i( | ^; |, J6 f. K0 f
cross_marquee.innerHTML=marqueecontent
- H7 A* A& X# oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 ]# K- C" f, r7 w
}8 n' o" v* z/ X) S
else if (document.layers){) s* Z2 D# E, o7 x/ }5 f# T" K
ns_marquee=document.ns_marquee.document.ns_marquee2
( s" l" N7 x+ l7 @" F* | G6 Jns_marquee.left=marqueewidth+8+ i3 |5 ]$ A! T. ^5 c
ns_marquee.document.write(marqueecontent)
3 v0 H S% z6 G q6 B+ W4 Y$ vns_marquee.document.close()8 d( E% w) E3 T4 |5 G$ b
actualwidth=ns_marquee.document.width6 i# x& C: E) x3 b4 e0 S9 P! i
}
% z7 C# e2 o& i$ i/ O6 W, jlefttime=setInterval("scrollmarquee()",20)
* s% p* z$ r' \/ U* y! g- l}. L- Z, X: @) J: h0 Q
window.onload=populate; N% [% t4 J# B
! m- T3 i, K. }7 ufunction scrollmarquee(){) X. D8 t% L0 Z" U/ E- y. ?$ z
if (iedom){; J( _3 O. `6 ]; Y- A4 Q5 U" K1 D
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 O: B7 k, R* P" F/ h, n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 H9 i, K8 p: Z. ~; q
else" h f# `* C5 [9 d# V& ^: @# D6 @
cross_marquee.style.left=marqueewidth+8, v( D- P% \0 e& R
) t% ]# w9 I4 N
}1 K4 e5 r" d2 S) E8 n* C
else if (document.layers){7 C K5 O H6 a4 C' d L( F3 p
if (ns_marquee.left>(actualwidth*(-1)+8))) u: N& ?7 f! E4 b8 r; ~( r
ns_marquee.left-=copyspeed
) O9 {$ U& t1 P" c* H4 Q% D' }else+ c% [% _' @& [( {1 y
ns_marquee.left=marqueewidth+8
' |6 L" u# M0 v9 V4 e9 d. _/ R}; W# s0 n. |4 f3 U) U
}
' F& t* C4 s7 ]# ~# ?0 ^
( H1 U( e' I& y* V. K/ A3 E2 z; Wif (iedom||document.layers){
i* H) p* I5 g$ u3 R8 ~with (document){
" P) H6 h; E% ]. |: ~* c6 n, `( I/ q( sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 n/ e- z: `# `
if (iedom){
8 X4 A4 e+ o1 F/ h2 Y/ Y) Rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">') W4 w# f5 ^) r% ~* t* }& F$ g2 W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 j- q4 q) E V! p j4 h4 p. P6 [write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 A/ S$ X! F* `; ~/ R& @8 v' z. r9 l
write('</div>')
' d9 m* a4 X n1 W0 e9 W}
1 q4 M# X# V7 yelse if (document.layers){
/ Y V" J. F# [5 w pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). ~: ?' `( F& G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( B5 s$ f2 u" n( }
write('</ilayer>')- O: _1 s j" U& x2 s9 J
}9 Y6 [$ S5 T7 j
document.write('</td></table>')! V6 _9 W* A6 s% r
}
; Y( ^( Q* x4 T8 R}) D2 P6 Q" g2 e: X
</script> |
|