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

|
网页之跑马灯文字特效
//修改宽度
* J7 R$ r) Y% |9 i8 @) Y, s! O% bvar marqueewidth=300- Z. K+ w4 S B' z2 G& _' N
//高度' ~+ Q% h3 R+ E3 r' _, H- k
var marqueeheight=258 m. J; i. L& S, N* B x+ F8 m
//速度(1-10)- G0 b' {3 H- h# F
var marqueespeed=3
& T3 o, \: b& Z% w" Y6 A5 N5 f! f* I//背景颜色
# H: |6 b0 d. ]var marqueebgcolor="#FFFFFF"
! R8 m$ A# W X8 B) }1 c- D//是否能暂停 (0=no. 1=yes)?
+ q1 L# l: {; `5 q6 J& Fvar pauseit=1
6 P! `; N3 W; K0 [( y4 {' k% v! R l) A( M( }# m
//修改显示内容! E F3 g3 h2 W% a- ^% u
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ P/ _$ u" j& o: W
9 S- @; k& D" j" ^! l& V* m+ s
& L& ]# i$ N& W* d9 Q////下面不需改变////////////) C7 S, W# I' q1 t+ ^6 U% `( ?
2 O( {$ {. P# v: b1 L4 M3 K& Pvar copyspeed=marqueespeed; f/ Z' i5 h" K& `; F. ], o6 e
var pausespeed=(pauseit==0)? copyspeed: 0
8 R* H- z& O$ rvar iedom=document.all||document.getElementById
' ?5 s8 i s" T9 Q5 Zif (iedom)
4 ^/ Y0 c2 J( q1 ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 D5 E0 y! X. a+ Y/ Xvar actualwidth=''+ ^* ]2 N$ C2 L$ m
var cross_marquee, ns_marquee& H& t/ k( ^* u; a4 p3 L- u
4 C* @$ J8 G2 m- ~function populate(){% `" z0 R7 Z* w# D; [
if (iedom){
/ H; s& @( j4 S+ o$ J& _" D' Fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) b4 W% Q' E! E5 |$ z0 lcross_marquee.style.left=marqueewidth+8
5 O3 ]" `( n b+ Wcross_marquee.innerHTML=marqueecontent
% Q% W* D5 @$ c, Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% r4 n# |+ T- \+ E) e8 @
}# j4 j- Z2 [$ A4 t; ?
else if (document.layers){
$ x6 C# \! B0 w3 R9 g3 K# gns_marquee=document.ns_marquee.document.ns_marquee2
" O# ?9 C0 i# h7 ans_marquee.left=marqueewidth+8& r& ]4 S% Q' X* \2 u
ns_marquee.document.write(marqueecontent)% Z/ l' J% m: c' F+ b" m' b+ {
ns_marquee.document.close()
2 t/ ^6 B5 O* nactualwidth=ns_marquee.document.width/ ` S) V5 a" ~! \
}
2 E9 B& P Q5 U/ d# Hlefttime=setInterval("scrollmarquee()",20)
' R0 ~3 [; }3 X5 d8 q. y}
5 i! [: W8 M1 }window.onload=populate& V! j# w) o$ s, W0 Q3 m. u
6 j# Q6 \. f& p! ]- B* pfunction scrollmarquee(){8 Y- N5 J; [' f2 b% Z( I6 R
if (iedom){# t* T% ~" T8 v! D
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) a5 J- w/ n1 F3 k9 ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 b1 e7 L3 G9 A' p' K/ F% Helse2 r2 w) E( t1 U+ Z/ q2 M
cross_marquee.style.left=marqueewidth+8
4 q. g# s* j0 m' L
8 s7 `# O1 Q0 D% h* b! s8 e9 i}; t$ l" \6 {0 F6 d0 @( j
else if (document.layers){
. C4 o" l) B' H+ `if (ns_marquee.left>(actualwidth*(-1)+8))
# C2 c6 A7 |& y6 |ns_marquee.left-=copyspeed; F/ Q+ ?2 _2 b6 b: x- W8 J
else
2 i) N- {8 K( d+ {3 g4 ins_marquee.left=marqueewidth+8: R4 R1 z. C' Z/ T
}
- Y* h; Y' m/ c. r. h9 v3 v}) T: ~3 D2 i8 p5 u0 H
' B4 a: |: O- O5 i7 x
if (iedom||document.layers){
* _+ c6 \* l: @! G4 Zwith (document){
; q7 M3 M! `% c D/ V+ [" idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ f3 s6 |2 C! L2 M4 y
if (iedom){
. r: N; N' e4 s0 K6 Hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' a+ @5 r0 l' I
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- r" {8 Z) ^& c9 X/ x. M% ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, @2 t- A( @/ y0 B& ~7 D- J' _write('</div>')
+ m- u" ~/ ~' D) ^}
y3 }+ t7 J, Z) Y* Welse if (document.layers){
# Z. r" P3 \ d* Q9 a4 p7 {3 x' xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
|. t- F }" C; Z9 dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* ~' r6 N% s+ s9 u! H$ V [. ]write('</ilayer>')
" I3 Y* f- B& J; k" w9 @9 s( v}
2 n0 j, C2 l6 c/ ^+ r: J# c6 ~document.write('</td></table>')
1 f; H. y4 W; t! m9 l}! b1 {$ T, M6 O! ?. k, t
}$ N& m. z7 T; H6 V5 A
</script> |
|