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

|
网页之跑马灯文字特效
//修改宽度9 Y1 X# T6 U; c9 y1 m% `, E1 V# z
var marqueewidth=300& I; y t9 s* w% [* x
//高度
, f4 W, p0 K9 `2 ~; cvar marqueeheight=25) L. }' n$ {. D" a2 a
//速度(1-10)
, I( \$ ^( P% G. I9 { dvar marqueespeed=3
! P: q) Z( ]) `* H- l# Z//背景颜色" c. M- Y% Y$ G$ B; g5 h2 g
var marqueebgcolor="#FFFFFF"
6 r9 D [! V& v* B) v//是否能暂停 (0=no. 1=yes)? P' F7 ?# ~/ [4 {# [
var pauseit=1/ V8 l* ~+ }" L" K: Y
" u7 P* k. s, S//修改显示内容
- X3 @* n$ {. c: Bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ d8 a& w5 K3 g6 E/ E
& p. R$ A1 e. K/ ~0 S9 Q' T
1 e# }7 {4 ]) N2 Q////下面不需改变////////////
, E$ o- B& y5 z- B9 b. T: B5 a
! x% P8 n9 g0 H( Svar copyspeed=marqueespeed
) p8 q$ F; |+ Tvar pausespeed=(pauseit==0)? copyspeed: 0
8 i' B0 Y# s5 m/ v( x" K. y8 Ivar iedom=document.all||document.getElementById* F* u" X$ D) u
if (iedom)
6 {9 X7 Z" {* Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 O3 d2 | U% j' u& \
var actualwidth=''
) D" j9 [6 }$ g; n: J+ xvar cross_marquee, ns_marquee
1 o1 F; g9 K: `. l. \! t( }# a' ~' x- U4 `; z
function populate(){
$ y+ H3 f& t* p& Vif (iedom){
& `+ [! \/ o& `8 @2 Jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 O: X# F( g. V, _) `9 hcross_marquee.style.left=marqueewidth+8
9 t% R0 M: x+ ~6 Mcross_marquee.innerHTML=marqueecontent
- q/ `+ Q! n: i+ n: k$ ^) m7 ]actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; A# P3 h9 P, \9 I" \- F6 Z- y}
. x4 Z' R2 ^3 Telse if (document.layers){3 O$ Q0 l0 J" X1 T, |
ns_marquee=document.ns_marquee.document.ns_marquee24 f* F3 \9 |0 f" v/ G: J. w1 `
ns_marquee.left=marqueewidth+8
. F( J$ K7 Z+ f3 mns_marquee.document.write(marqueecontent)1 G- s4 R6 X7 }6 Q: s- @
ns_marquee.document.close()
5 F4 U. `# F0 tactualwidth=ns_marquee.document.width7 x8 @. p" ^" v9 ` R4 N
}0 c+ Y% o1 ? W3 H' v9 f B5 l
lefttime=setInterval("scrollmarquee()",20)
5 P, ~5 E5 z: ?" r; U# y: S g# ~}
: Z2 \9 u4 ?5 ~1 w5 f2 y/ Lwindow.onload=populate+ Y: |, p# u3 K1 m& d+ y( s
* p7 f$ I7 I" S% d5 K6 V1 w
function scrollmarquee(){
$ a$ K8 b- u1 u& y: F' h. d( Cif (iedom){
/ t* S0 i7 f, W- w+ Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
@& F; Q9 T1 {6 J# ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' q. Y3 v' W! \! O: V" c0 P' nelse9 a; K0 j' f4 A
cross_marquee.style.left=marqueewidth+8
/ w( i% p8 Z8 Q8 W/ E8 `& E/ k3 P
}
; D0 ]/ W9 N9 a5 R3 selse if (document.layers){
( F# t9 j* R) S% Q* m: {. r" ?. qif (ns_marquee.left>(actualwidth*(-1)+8))
+ u' L- | P# _: A" mns_marquee.left-=copyspeed
$ @* q# E. j' Z } H! h2 v, \else/ y8 k/ V8 h$ h" ?" h# Y1 X+ M
ns_marquee.left=marqueewidth+82 P4 S/ V; ^2 V: m. M, Z1 @! G& o
}
$ G1 W0 K& `* Y& F" w}
% L* o6 W1 V' Y+ B1 b1 M- t: R1 W
if (iedom||document.layers){
7 e& D- H9 i5 I$ o2 T- {' V; lwith (document){
/ l, n$ @9 D3 M6 Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( B: @+ c; o& a' b4 d- n) j- Z( w
if (iedom){
8 N- A& U: K: E: r; D1 H- _write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 f/ _" w/ a V* n# B4 Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); {2 E4 c7 y j5 K
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! i0 v+ g6 s* v1 X) Ewrite('</div>')
, t( _" i h/ ~$ t. J6 K. L1 ?}
" m0 b" n, ~( relse if (document.layers){
4 q% A0 l8 ` d4 I" J; \/ M5 R0 hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ |% F7 D5 @* z$ iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 ~& {' Y; ?+ D! i" Bwrite('</ilayer>')1 m) ^2 v4 H8 ?6 y5 X
}+ ? L9 e/ Z# [# Q) B8 J6 F" m" b
document.write('</td></table>')
( @6 Z( y8 T: p5 j4 u2 W" k0 v1 @}" C+ F! w. H5 Y( o2 f
}
; C, S5 }. ] N$ u* n0 X1 S</script> |
|