返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 U! J( f" K) {0 S/ C) k, f
var marqueewidth=300
8 ?" O  ^) d  @3 V: `+ l//高度1 {9 r; ?" g- Z8 C+ |& _0 Q
var marqueeheight=25, s8 A' ~- }* R. T6 s! F
//速度(1-10)
# x& r2 S# I! wvar marqueespeed=3
6 d4 ~2 v, f: Y* }! q0 c2 i//背景颜色
4 C' C. _- z/ ~8 E; r9 v: Tvar marqueebgcolor="#FFFFFF"
3 p4 x( B. g, t. x//是否能暂停 (0=no. 1=yes)?. [0 _4 ?! P/ S$ J
var pauseit=17 F4 g- e% q0 h: ?+ S7 ^( c
% S1 v. Z5 G4 J& T
//修改显示内容3 R  T6 Z5 J% @3 d% h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 L$ j% v/ L. o' M2 Y! J9 t8 a: Q: t% Y- C  Y
. p. m1 t8 J: |
////下面不需改变////////////% [8 M+ `0 X6 r% b2 U: h& Z

( B  Q- e1 X6 ?/ z) Q! u3 ~var copyspeed=marqueespeed& y+ k+ d5 i- X6 {( Q! B
var pausespeed=(pauseit==0)? copyspeed: 0
; r* l) H' t6 ^8 M4 Rvar iedom=document.all||document.getElementById
  q) K( y7 v/ \; f2 T0 n& c5 vif (iedom)
& D' U8 s6 J/ `) _+ Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( D3 C! f) E; K" k! b2 g1 R7 S& Pvar actualwidth=''
$ L8 ?. O6 i0 b/ v) [var cross_marquee, ns_marquee
$ Y( y# n1 r8 T9 H6 Q/ {. ?6 \9 R5 I3 U0 B) k, S, d
function populate(){
, P, k* ~7 b/ lif (iedom){
" Y: t5 q' B! a  N* Xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: u2 n" M: I. m
cross_marquee.style.left=marqueewidth+8
6 j6 Y/ u) q% F* W/ Z0 I* qcross_marquee.innerHTML=marqueecontent
$ J0 }7 b' N6 c( B& Dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 z0 ^# g! n) j0 w! \}0 R  H. Z. ~, k) @+ n
else if (document.layers){0 F1 ?. h1 Y2 b; ]4 l
ns_marquee=document.ns_marquee.document.ns_marquee2
0 j; b& n* ^4 e% G! |3 Ins_marquee.left=marqueewidth+8' U4 |9 _8 [4 c+ P5 ?! F& \  t' M
ns_marquee.document.write(marqueecontent)( P5 F* n" o! T
ns_marquee.document.close()7 N0 r' \# N- t8 y) ?, L( p
actualwidth=ns_marquee.document.width
$ B3 K2 X+ |& d, k}' x) h, ]: w( V
lefttime=setInterval("scrollmarquee()",20)0 ]3 R; r! o' ?3 q
}
6 M' f1 h9 Y( x+ ?window.onload=populate: A' B' B* y$ F( s

4 S, m5 k& Z. O5 S3 S) {; w3 Q, Kfunction scrollmarquee(){1 V# A* v2 e4 Y
if (iedom){
* z4 p4 @4 t% `& E4 T) h$ rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): \3 L$ h( P; X7 I9 X
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- Z( I' b; d! W: F; ~/ R
else/ P7 K2 [- s# K" j
cross_marquee.style.left=marqueewidth+8/ g6 g& U  K" g/ N" c

; E& b/ X7 X- `  r}
. G3 x& y" d8 Nelse if (document.layers){
2 q4 `4 y9 r& P! K$ fif (ns_marquee.left>(actualwidth*(-1)+8))1 m% h. a2 T; x
ns_marquee.left-=copyspeed, v2 F- F* _4 B& s
else4 e7 m* R, H3 H: Y/ W0 x* q  e
ns_marquee.left=marqueewidth+8; W8 {3 ]% t$ P0 H7 e/ Y
}( _) w4 J, P  ]" o
}: m9 x: [* E% }! r3 P2 G8 R' f
8 q9 a( ?# S) \" h. X# _
if (iedom||document.layers){: a, r0 D8 W( m2 f: f" M. _
with (document){
8 J& W$ c9 l( A# _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ e3 J8 x- ~! O) S! K; Wif (iedom){
3 \$ Q" f: d' m8 _! L" T. h1 ]5 owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 m/ z) u( Y6 c$ P/ w1 `, f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! [0 j9 n+ B3 e( hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ F! X( G# X3 h! z- i
write('</div>')0 x& `5 V; y& `
}
; F! n' }- M4 s+ felse if (document.layers){
' B) E7 R' h; n: P$ n  @write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 L1 E2 A5 R+ X5 P- ^) q% R- bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: \  u! y* i+ X9 z3 c* Pwrite('</ilayer>')
- v  b5 B# K- P# L* b}
) q( A3 x) V& Q/ D' t% Adocument.write('</td></table>')
* c* l1 c% U8 S" U5 V- k}
/ `0 F2 F+ ?9 Q7 ~3 N" N" W}
; M- a$ P/ t9 Y8 {</script>

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