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

|
网页之跑马灯文字特效
//修改宽度
( v/ p5 s7 h. R* T# E% e9 Q! x9 xvar marqueewidth=3003 B8 o! h+ p2 i3 ~6 ~% D# w
//高度/ ?8 i0 Z/ t( Z- q3 C( t5 G
var marqueeheight=25' y& w8 d$ `" z: T" j- @
//速度(1-10) v( b/ z" M+ M9 J0 u) |. F& i) ~
var marqueespeed=3
1 M/ U n& J$ y//背景颜色. V, u% A- \/ T7 b
var marqueebgcolor="#FFFFFF"
* o/ ~; F' f1 L6 G//是否能暂停 (0=no. 1=yes)?' q! d& O+ w- d/ |9 |
var pauseit=1- W0 A) Z+ I7 w$ J0 ~+ [& n
/ [ [: j) A/ O
//修改显示内容, \2 x' f0 |( n1 _" N
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" i6 H, H; u3 ]4 W* G+ D7 R2 `0 ~( B
& T3 |0 @+ R& U! O' `4 j
////下面不需改变////////////3 S/ v8 [# v3 \% Q
- P6 u @+ `2 f7 U% W
var copyspeed=marqueespeed& h" Z* D. Z3 }5 ^' m
var pausespeed=(pauseit==0)? copyspeed: 0
7 I, L9 Y Q! f3 Uvar iedom=document.all||document.getElementById ^* m' v k. d; i3 h
if (iedom)
( E/ l |/ {% n0 Y V% d! a. H2 Y7 Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 r; C5 c1 P5 Y0 w% U
var actualwidth='') E4 }# G% _2 [! V9 b: S
var cross_marquee, ns_marquee6 z$ m3 h3 B+ O; z8 X! X: f
4 I7 s* B& o5 ~9 K" ?function populate(){) R: j+ r3 U# {1 L' @ `
if (iedom){
8 j: h9 M2 }1 ]; |9 V) J ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 e1 T8 r- H$ S: {, G- ]* [cross_marquee.style.left=marqueewidth+8
5 E2 [1 Z( G/ R' y1 O; \4 Ncross_marquee.innerHTML=marqueecontent
) K6 s( O" D5 [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) [: Y3 j9 U6 d, c; S# D
}4 B1 G- ]3 q# L$ i- m
else if (document.layers){
' V* d$ u4 l6 B- sns_marquee=document.ns_marquee.document.ns_marquee2
7 H+ `. ]7 m3 C9 G! q# F7 Tns_marquee.left=marqueewidth+8% g8 q3 f; b9 ~: w W, Q3 t
ns_marquee.document.write(marqueecontent)
; P) c0 C9 T$ {0 i0 {% Xns_marquee.document.close()
1 I, U- [' a9 ?% S( `actualwidth=ns_marquee.document.width! C( l) J" P9 |& M: n
}
& l2 Y# @( c2 Z/ O- elefttime=setInterval("scrollmarquee()",20)* i/ U! U; V0 Y4 U3 ^0 X9 f/ L8 x
}: a, l; V3 w5 ]7 T+ x
window.onload=populate* P, Z1 q5 o, c8 V
" V O5 }+ T( A8 X2 J6 ~* v* t
function scrollmarquee(){
5 e" a- K( m( I: T- Sif (iedom){
( W; c9 b+ [/ u1 F0 Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 W& Q, ? e' ~+ q* G6 W2 }4 w
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; S( y* [3 d$ E- M. h: p
else
1 |9 ^1 N2 a$ d! }( ^5 o/ wcross_marquee.style.left=marqueewidth+88 k7 u( z; d, Z- `* ~7 \) }( P* n
: I: U! T X# G" m+ g% [7 E
}
5 H- Q& d. ^* Eelse if (document.layers){
! Z. U6 K8 A! mif (ns_marquee.left>(actualwidth*(-1)+8))
1 N4 W% A3 m& o3 G9 R+ p: ons_marquee.left-=copyspeed
. A E& }9 U( u0 p' belse4 d: P7 F, \( D4 h! j0 C% I
ns_marquee.left=marqueewidth+8/ v% N/ h3 e' Q7 U4 M0 F4 l3 d2 [0 S
}
; z. o1 R. g* |$ Z6 t) v) _( v$ ?}
) d' B% T/ @2 N$ M* C- V" w8 G+ Q' m3 x" O1 e
if (iedom||document.layers){. A e5 I6 F; l
with (document){$ N: X' r, z J! z* O" V# t
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 |! m0 g' A0 l: x8 g% u) }4 Dif (iedom){
1 q4 U5 b$ d) l g5 H# }, n5 nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 W$ ^& R* K- c$ V' r2 Y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 s5 \9 ~( ^( Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' l0 I' W; C, }3 T
write('</div>')3 ?1 c7 m$ ?3 y
}
. n& `& P @4 F1 B% ^" z; C/ j: Velse if (document.layers){
, P' f7 b1 m) s+ y# p2 i* X; lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, h# ~& E; Y: o4 {write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; O4 H/ A2 o- |& S, \$ Bwrite('</ilayer>'): w6 g& q, n! k/ i5 U
}, X+ G$ [. Q; n- Z
document.write('</td></table>')# o$ e/ A( s, o( l0 r7 s' X: g5 U- l
}
6 H: E9 o/ @8 v# H" g+ q}, J+ v0 p' {6 O9 \
</script> |
|