返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# t! C4 b# A7 N) V# j9 kvar marqueewidth=300
+ y- d$ }* u" }# z//高度
" P" B; v; _+ g: p% k$ a7 lvar marqueeheight=25+ ~9 b1 B* Z8 }( |! F
//速度(1-10)
( ~; ?& O/ x2 ^* v* ]var marqueespeed=39 Z5 _/ T( e1 t* y7 E6 O
//背景颜色
  M6 D' n6 u! i9 b0 q- B6 ^% A! \var marqueebgcolor="#FFFFFF"$ A; F! T6 ~; @* ?
//是否能暂停 (0=no. 1=yes)?
1 e  Y( \5 I9 j. u8 C$ W( u# z! ovar pauseit=1( E, ?2 n$ E8 e  f

/ ^3 H$ v) B! K//修改显示内容& _. R5 m5 O% L6 A! q9 a
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! h7 ?4 Y$ y0 G# d7 w) @- h& e( x( r, B( h2 T
; D- a/ \) \" Z4 e1 p8 v
////下面不需改变////////////$ X  K( d7 w3 G, [
3 j! ?1 M$ e3 }( Z
var copyspeed=marqueespeed
- F. k: Y" V4 }8 M2 K: a$ zvar pausespeed=(pauseit==0)? copyspeed: 0
) z7 ~( e/ R4 L5 |5 Q4 S9 Xvar iedom=document.all||document.getElementById3 u5 j5 M2 A: j4 C1 }; a
if (iedom)
8 J. k* q/ E& M8 m1 Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- C( o, p% L- N4 w. evar actualwidth=''
8 d6 F* [7 C' F0 b$ O1 V  P6 X0 X& p. t9 Yvar cross_marquee, ns_marquee
1 Y) _1 T" ]& i5 \8 o, C8 |( a
7 J  s/ T$ L8 d6 J2 O+ h: Wfunction populate(){
- N6 K) K1 d( F& ?! F1 ~* U6 Kif (iedom){4 r$ t3 ~8 J8 N6 l+ g+ r! S
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 \9 _8 z% I9 ~4 ^( y) t
cross_marquee.style.left=marqueewidth+8: Y8 {0 U% R* y7 P3 S' B
cross_marquee.innerHTML=marqueecontent$ d. J. N9 Y/ c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" W$ Q, {' L& q, g% c/ U2 O
}
* g5 m( \5 k  g& \) j  welse if (document.layers){
! Y0 e- V. R- Q" x6 ^( M3 f1 Xns_marquee=document.ns_marquee.document.ns_marquee2
, l" y6 p6 H, mns_marquee.left=marqueewidth+8
; _8 K3 I5 c+ G% _6 ]7 Zns_marquee.document.write(marqueecontent)
: t2 ^6 ]# e- W/ J6 c- W& \ns_marquee.document.close()
# X& O& X5 Y' E  _actualwidth=ns_marquee.document.width
; {5 _9 G) K0 b) A8 o}
# g) _; k3 C6 C9 Ylefttime=setInterval("scrollmarquee()",20)
9 n5 G4 A2 w* Y  K}3 J5 Z# z# {- Z) E" D. J: U
window.onload=populate) i, d0 u! s: y9 G% G
2 }) |4 p# h0 c$ x
function scrollmarquee(){
8 e# w9 \8 G. Vif (iedom){
( v! I4 c: E  n. g: i( C% ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; {' k( N/ a0 J) Lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! o: a. P0 t& F) \else
$ b2 ^7 `0 w( [- Hcross_marquee.style.left=marqueewidth+8
! m% _) g  Q- o: p
9 s. |* b8 r" y; A8 k}
; X* f2 `) U) z. ^. Uelse if (document.layers){
4 h' l0 F  [9 Q6 `4 Z+ Vif (ns_marquee.left>(actualwidth*(-1)+8))2 U: e4 {. p0 Q
ns_marquee.left-=copyspeed' w/ A7 C  G4 f6 E' k$ d2 V, g: v
else
  V* m; \- g& B3 J/ lns_marquee.left=marqueewidth+8
7 L- d+ J9 N) }: m7 E}
0 q! b7 e$ v1 _) g/ U, L}
/ _4 r% i$ Y% N4 Q$ G
$ i0 x( d$ l, g3 _; w7 \if (iedom||document.layers){
& K9 m% b4 y) t+ ^with (document){
$ ~2 P: O1 e) {2 ^5 pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& K# J* f. {# V( ?; N% s( \if (iedom){* C6 d, @2 `" V" o
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" a0 A  x: X. Pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 ~  N0 m' B& V( M$ H4 z1 g  Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 y/ u# z# y7 H( s3 a. `& |" N4 V4 v2 D
write('</div>')
; b$ G& J; M: y}' L& U( X& V2 T1 a. {4 V4 x
else if (document.layers){
# Q& l& d; n+ W; h9 n" X' h& Rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 w1 H2 X" f3 b5 w3 X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 L" U/ e/ x2 V9 E# hwrite('</ilayer>')
5 {" u. z( j  o, I+ x- y8 P2 \6 x}
; e6 ]* X: L) ^4 H% jdocument.write('</td></table>')
, ], G; q6 R: T2 \6 m}
8 [5 F* b: X( k" U) F: z}
- n; o$ M" ]& \, ^2 S</script>

返回列表
【捌玖网络】已经运行: