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

|
网页之跑马灯文字特效
//修改宽度
. `. J, P' }* \0 w+ R& F. Hvar marqueewidth=300) y( ~1 T! D+ s$ ^
//高度6 Q% a0 Z& i; _
var marqueeheight=253 M# G# ~& S& X# e) v
//速度(1-10)
* ?7 f0 B! w8 K. I) @) S% Gvar marqueespeed=3
* M5 `$ d3 W: g8 U: X g1 ?//背景颜色) H) Q H$ ]1 C! a/ f: L9 V
var marqueebgcolor="#FFFFFF"
' R. I$ C$ U& c+ c3 r. g# u//是否能暂停 (0=no. 1=yes)?
1 p5 [! `$ H8 Lvar pauseit=18 P. G+ M; W( B
" { T1 Z2 {0 z5 U6 ~" v: J9 a
//修改显示内容
# o5 G% K) R2 Z4 qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ o4 ]5 g& u" R& [! ]
; m. F9 k& @. _1 c- f3 a+ \. ?3 t9 C% [3 M" B
////下面不需改变////////////
* A9 I8 r* q! K2 y1 u
2 a5 H! ]" \: ~ V: mvar copyspeed=marqueespeed9 |7 b; V+ d' k- D2 T- B
var pausespeed=(pauseit==0)? copyspeed: 0
# y {3 u! b% G M3 R k3 O0 avar iedom=document.all||document.getElementById+ x" ~. c1 v7 ]4 o
if (iedom)
. C# e3 ?: M% t* K7 t& t! ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 D& O" m6 X2 q6 i; ?+ [9 n9 nvar actualwidth=''
* q: F( I/ j3 {var cross_marquee, ns_marquee
V6 |4 }% v: t( M2 r
G; ~+ f& @! d% A; w$ bfunction populate(){
- ]8 ?8 w: K* L& X8 Iif (iedom){
( @5 j2 z* s9 s( A/ gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 k4 j" B4 t1 f+ g5 `
cross_marquee.style.left=marqueewidth+8
; N$ a- D( F% _cross_marquee.innerHTML=marqueecontent( C4 H4 m* x% S
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& D. ]! ]% m2 Y. C& T
}2 B3 [. t( s4 p/ ~- I
else if (document.layers){
# X% d& Z9 y) o* pns_marquee=document.ns_marquee.document.ns_marquee26 S* P% X" t+ T3 a5 k
ns_marquee.left=marqueewidth+8
8 K8 K- }" u! ^# T% wns_marquee.document.write(marqueecontent)( v' e$ _5 B# ~* n. `) h8 ^% L, H
ns_marquee.document.close()" F V+ {6 n f+ N1 v/ T4 x# @
actualwidth=ns_marquee.document.width; y/ e1 Q- D& S0 q
}
& k* J$ q ]' [lefttime=setInterval("scrollmarquee()",20)( {% c p& U5 Z* G3 K. K% A+ T* n
}- Z* q0 d( I* s
window.onload=populate# x5 q& `' \. ]& B8 s
3 A, h# }9 M+ X1 N$ J& U" Y
function scrollmarquee(){9 o4 R% h$ k: m& d/ u/ i
if (iedom){+ \* }2 O2 V1 \+ v: ^
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) g4 {% A& a* B% n+ Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* n+ L# O7 B* S/ ~& e% u5 O7 k9 xelse2 u" |" x3 ?% c" U1 r% T$ @
cross_marquee.style.left=marqueewidth+87 D1 F, h2 H& J9 g/ r2 E; ^! q
" ?2 K9 ]' y3 S}
$ \/ i. g. v4 }else if (document.layers){: H5 l; Q, w; u2 d
if (ns_marquee.left>(actualwidth*(-1)+8))% P4 \8 o+ F' }5 @
ns_marquee.left-=copyspeed
7 [6 ]1 W( x: F velse' K3 G9 A# P; _5 S5 o
ns_marquee.left=marqueewidth+8
- _* B) y; s4 s; h, d+ e}- Y( d# F T( [7 n
}8 ^/ N2 @/ t6 o4 F# S5 q e: Y
0 C3 i6 G; k L; P
if (iedom||document.layers){0 I0 G& M, Z2 G
with (document){: b Q+ i; y9 r% A T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" c, P7 o- O$ B: T7 @7 ?" nif (iedom){
3 m0 W; e2 v+ H% F- ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* D2 ?6 t9 D3 s' @1 `/ R s; e7 h; ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" E5 g6 Y; O: b$ e1 v3 H8 X8 Iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 u& y2 y# P; h! g E! fwrite('</div>')& {' F) @. Z& @7 D* F$ Z3 j- J
}# ?. z* o4 ^; b" w; a% V8 V
else if (document.layers){# e b& h, O- R2 H8 i$ I* G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" b. L$ s# F# Y' A9 Dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 s6 G: A3 B5 Z/ H) O
write('</ilayer>')$ \, E( n" o9 Z/ }# H; T# [
}0 a4 u/ Y- s% J7 y4 w
document.write('</td></table>')
0 N8 ~$ ]4 ?$ i* i) X, Z- l}+ p# a& Y& }* ~
}% f% ]; y$ ~ ]; v$ v) `
</script> |
|