返回列表 发帖

网页之跑马灯文字特效

//修改宽度( r- u' F  w9 f1 K
var marqueewidth=3003 ^6 T2 ]' K/ O
//高度
" j5 s" k" G& ~3 ovar marqueeheight=25
- O. u- U/ t( m; b& T8 N4 l//速度(1-10)
8 |3 N* o: K) w' }8 \5 O1 c0 x3 gvar marqueespeed=3
; _) u  k/ q: D+ Y+ g/ t: o/ Z+ A//背景颜色
/ x5 j6 M$ Q! tvar marqueebgcolor="#FFFFFF"' j) Z  K$ S. S9 M
//是否能暂停 (0=no. 1=yes)?
" B) a% p9 n) U% G4 e" Bvar pauseit=1
6 h  O, V* g: q0 E8 E. |. Q9 _# m) Q0 J# k) x) r
//修改显示内容% U4 A1 |- d' G- {. m5 y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 M8 w3 H7 G4 g9 J5 z
9 C- \' d+ o$ t$ y+ w6 p1 U8 G* a4 G2 x- U. a$ l
////下面不需改变////////////
+ C% M! S3 v, A! X( ]' h7 u* Q5 D# U3 X& C( |9 x
var copyspeed=marqueespeed) v4 v5 \) l) S6 o) @
var pausespeed=(pauseit==0)? copyspeed: 0( k8 v, P0 R4 Y% M9 Q0 b! `5 w+ v, |
var iedom=document.all||document.getElementById  u/ D. s  _! x# C/ r
if (iedom)7 E3 ^8 D7 `1 @$ M  Q# I$ k& T2 t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 H, `+ I" @* L: K% B; A9 h2 x( ivar actualwidth=''8 b/ N5 e$ Y, K- V, F' ]; X5 \$ `
var cross_marquee, ns_marquee1 Q9 ^1 c# X7 t# Z, E# J
6 k8 ]% Q5 a/ m; @+ T1 j# v
function populate(){5 U5 P" i; _; c& a" {
if (iedom){
' z8 }1 S1 C! H; Kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# r+ M: g. A6 n8 u1 ~6 @6 d. p
cross_marquee.style.left=marqueewidth+8
0 P% F2 J1 H+ F/ s' v1 @/ `5 l  ucross_marquee.innerHTML=marqueecontent6 z; V8 w6 \) m* C/ U) b- k, k2 @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ J% E' v% |' g5 b# b  p
}* T; X# C( ]4 c, U. v
else if (document.layers){  T" q- Q+ R! E7 e; [. f, |4 b
ns_marquee=document.ns_marquee.document.ns_marquee2
/ D7 P" h5 P7 W4 ?1 u9 Rns_marquee.left=marqueewidth+8
7 J: ~) U2 T/ J6 Q$ J' Cns_marquee.document.write(marqueecontent)
8 l$ D# @) P& [  ]0 [ns_marquee.document.close()0 _+ `% a; q8 _
actualwidth=ns_marquee.document.width8 v( F! ~; d, k6 j& d/ N
}
6 b( T6 @( F5 J. p7 Rlefttime=setInterval("scrollmarquee()",20)
7 S" z% t2 |6 ?}
2 e/ \' r3 }, Q5 |window.onload=populate
7 `. L' W6 q/ |9 ~- u  r; R
- _  |" v$ v2 }( z& tfunction scrollmarquee(){- P) V6 `* v+ O
if (iedom){
* S7 C; }- Y& A9 rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" [9 k' H' X4 k' e# p
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' v' l; }) T* T5 _2 E
else. y. ^3 ^2 t5 f! u4 Y
cross_marquee.style.left=marqueewidth+8" }1 }# y7 i, \, ?' i
; T: A, m: b+ h; h( O: ^2 E# Z
}
/ g) d, O+ Z5 r* W% Melse if (document.layers){
' ?- e# @8 R9 N0 zif (ns_marquee.left>(actualwidth*(-1)+8))* u5 m7 ~1 p% O) q. ?* [
ns_marquee.left-=copyspeed
( |9 a/ [" {" Z' Felse& `3 I5 }5 h0 o! ]6 i
ns_marquee.left=marqueewidth+8
4 `' c7 a. N# T' L  d}, L5 |- y& h3 G; d1 M
}. _- D3 N5 Y$ u& Z/ l

$ _' h% p* |0 [5 R$ H4 _3 Tif (iedom||document.layers){: a% v  @6 ]: ]) P4 D6 ^
with (document){' r( D) e& r- n0 o  F6 E+ L' x: G
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& b6 x# ~! t' c9 B+ `" ]! i% H  K% _
if (iedom){8 c) n" L' ^  u( L5 {4 |7 z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 c# |6 t( [/ k* V. q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 V. K! \7 \3 v
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 y* |2 i/ d8 m7 b# [write('</div>')
- X- P3 }: c) A' t* I0 d5 l6 \+ f}
( A$ U8 w( ~8 i- Q( L! nelse if (document.layers){
. T* X; ^9 U, h" I* q: B8 }6 P& _write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 |+ _! ~' B: o' F! k  y$ a' Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! M) x+ G5 y* f' ~. g2 _5 ?1 k1 g
write('</ilayer>')# W, Z3 Q2 G" x" }
}8 h: }1 ]# l- N: @; @6 S" C
document.write('</td></table>')
3 \1 ^& G6 h! m9 \" U}/ s. O$ P' ~2 S1 n
}" b% l6 C+ W+ Q+ g) S
</script>

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