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

|
网页之跑马灯文字特效
//修改宽度
) w- s" r7 U* e9 wvar marqueewidth=300: r, x O* }" @( u% J
//高度
% ~! F/ I0 s( b/ avar marqueeheight=25) r6 w4 \7 I; h0 T+ R* R
//速度(1-10)5 s' H# \' J. G/ u) B5 E2 Q
var marqueespeed=3% j" i% |) ?4 w S$ |
//背景颜色+ q9 s6 Q/ x$ t" G/ f" g m2 Z
var marqueebgcolor="#FFFFFF"
3 \2 i! J5 h; T. e7 X8 `//是否能暂停 (0=no. 1=yes)?* w6 q4 I, b8 x
var pauseit=1. I( D9 M9 {* `! t' L# g
7 G( F6 H+ C& g7 H6 H//修改显示内容
! d t( k9 i4 a- E* } d& @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. W4 _" Q4 l4 ?8 o& R- ]! v# o
/ C. \9 U7 p: h9 k K
* F% T1 @. P+ @6 ~7 d$ x3 E+ J! N////下面不需改变//////////// u' D8 i/ l) [* q7 k. H" M' Z& c
4 O- g( l/ S. b& Yvar copyspeed=marqueespeed
+ G/ {0 e6 c. n- g; ~$ U; u. `6 ]5 Xvar pausespeed=(pauseit==0)? copyspeed: 0
* T( d$ h! @- \0 k+ f4 l' pvar iedom=document.all||document.getElementById+ D# p- M1 i& u" n; V7 t A
if (iedom)) x$ h/ j% j0 W* I! A3 c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 l+ p/ K* \( y: N8 dvar actualwidth=''
3 L6 x0 w3 V: d; r6 _var cross_marquee, ns_marquee
* \$ B3 W. O: w4 F
# C1 P+ J: C- ?6 U7 Jfunction populate(){
- @. S3 _# t0 Nif (iedom){
! u# `7 Q( i [# [/ W( ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 N7 w- [7 w2 r/ O, s. p5 U3 U
cross_marquee.style.left=marqueewidth+8" o' t, ~ U e; s ?3 I
cross_marquee.innerHTML=marqueecontent; Z7 ?) @9 Q2 U, ]1 P% x7 A' f, x
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 O1 q' E, f6 u5 v5 d. b a! l
}1 f5 v1 g0 t& x1 b
else if (document.layers){) L: V$ ` u5 K A0 q
ns_marquee=document.ns_marquee.document.ns_marquee2
. G% |0 @7 `4 mns_marquee.left=marqueewidth+85 }8 ]/ c9 E( D4 `/ D6 k- y1 B: |
ns_marquee.document.write(marqueecontent)8 f0 [* Z! _9 `" ~
ns_marquee.document.close()
, G: b( S) L% w! |- v* Zactualwidth=ns_marquee.document.width" I2 c. Q" F$ R# `
}) g" m1 [7 H2 c7 f/ G. M* o. `4 b2 C
lefttime=setInterval("scrollmarquee()",20)
/ u. N: g6 z" @}
# K# b' Y4 O8 G" iwindow.onload=populate
% K7 n) e' V" v' H( W) {/ H6 p! O4 v9 I0 P2 ^
function scrollmarquee(){
* |+ e7 d6 U. ^% Q; C5 C- k2 sif (iedom){! q' T% A i* ~+ Z" f4 H" V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 b, A4 j3 X/ A5 }; g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ k3 K- ]' @! E' |- u
else
# L6 ~7 h1 | W" H- ` W% scross_marquee.style.left=marqueewidth+8( r. t& `6 {% `) Q
% e( a' i! {5 M# d8 W* K/ {; O}( X7 d: V" e) i! `. ?
else if (document.layers){
4 [9 T6 D" U* H- J' d( F: ~: vif (ns_marquee.left>(actualwidth*(-1)+8))
- B. u0 p1 L& M) c' h, Sns_marquee.left-=copyspeed
8 w" A1 ~1 B+ J7 l! relse8 Z, v1 }9 B$ A5 c5 A" k9 Q
ns_marquee.left=marqueewidth+8" D: _8 W# K* J3 B* H4 u
}- {. k. }) H7 _+ T
}
c# a1 g' A3 [8 w& }% G; E+ g9 f: s( A* p" S
if (iedom||document.layers){
" a# s6 I: A$ D# Awith (document){! @. z8 c, ^0 Q1 w, s
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ J' |# [8 w; z# Kif (iedom){7 B" a3 w) U6 E( d. z; v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 T* o9 `, x3 n6 n+ P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# }$ i$ A( _& }% r. _$ g7 l
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 b: {3 ]( P1 N/ i
write('</div>')" D+ J; Z$ `2 Q+ q# J* n
}$ G. }+ p0 h( R! I' w( D' o
else if (document.layers){( v4 z) r8 E7 @ q3 J
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& x5 _0 z( ~9 E* h$ c6 i! hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') G: G# k1 H0 E# E
write('</ilayer>')
; a: M% t! ?$ }7 U" H}
6 a6 v+ C' ~- I2 \. j0 K/ u! hdocument.write('</td></table>')
% D, T; l" [7 B" y& l$ w}5 I) _2 t C: `+ z2 z c* R
}
# U$ r& J6 X8 s0 Y</script> |
|