返回列表 发帖

网页之跑马灯文字特效

//修改宽度. r5 D- a4 }5 v9 [/ v, J
var marqueewidth=300
8 E1 S* X8 N8 R, H1 `' H' z: F# i9 n//高度
9 W7 |; V% g- v; i) uvar marqueeheight=25
) R- h$ o$ P5 k& {$ h. G* m//速度(1-10)! X" u7 C0 W  e! b5 r* ^
var marqueespeed=34 l8 L8 D4 B# c8 g( Y7 P+ z
//背景颜色+ |0 F# ?# ^$ G) A: E
var marqueebgcolor="#FFFFFF"
. o% c9 J* J! @4 G; f% c//是否能暂停 (0=no. 1=yes)?; w# m! q+ T# s+ W
var pauseit=1
; f8 ?# k" J- }  N
1 l1 g) r2 E/ W* S6 Q2 f3 T. b//修改显示内容
  g7 r# c) F! Y6 k$ n! l5 Ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! v" D* L) J; i1 u" R/ Y# N$ \
0 Z' y7 {1 y' `# _. F
/ E. k- h' u  \9 z8 }! b1 m3 S
////下面不需改变////////////
( g- D: U4 q; s4 H
- W1 X$ i9 D0 ]var copyspeed=marqueespeed% |8 C) W! u# ]
var pausespeed=(pauseit==0)? copyspeed: 0# `. p+ m( }+ Q, s1 b5 |
var iedom=document.all||document.getElementById
3 Y& O& i% h( @" yif (iedom)
9 \3 w  @+ i6 z! N6 h( adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* Z1 u+ E: b* e* h. B
var actualwidth='') f, e1 p, ^. B: Q5 w
var cross_marquee, ns_marquee' W9 a9 O3 u+ {/ k

4 J  |8 r* p, M% ?# F$ ^: P5 vfunction populate(){" d3 |$ R% K8 O1 x5 F1 W
if (iedom){* u: {# S, A3 g; @5 d- W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( Q/ E" x; n- _: r: b* N' S7 f5 R$ Bcross_marquee.style.left=marqueewidth+86 l5 X9 M% U. j1 v6 P
cross_marquee.innerHTML=marqueecontent5 |5 v0 m% I% _% [) N7 o3 C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 e  Z# l7 f" o. {9 y# @* l
}
" P' _: R& K: P4 U5 j- I' z2 [else if (document.layers){
6 H- r: X8 I8 Dns_marquee=document.ns_marquee.document.ns_marquee2
5 B- f: M+ \# ?- I0 X3 y/ @ns_marquee.left=marqueewidth+8
7 J4 ^0 u: ?# h/ k' G0 C5 u& B0 h- Vns_marquee.document.write(marqueecontent)7 i% E% V: V" D0 w0 _$ v
ns_marquee.document.close()
+ [. u7 Q. X; w$ Gactualwidth=ns_marquee.document.width( j% g7 |! W- w2 W% G  {. i0 @" y
}( I/ U) S2 X1 e5 R
lefttime=setInterval("scrollmarquee()",20)
: j; E: r' u- O* _! V. Z8 t}$ l: p5 s) G1 |2 G6 g
window.onload=populate
6 u6 B) ]$ p' c, H; k& S  c; ^" L6 L, v, B7 P6 K9 c
function scrollmarquee(){4 v* K" E5 \6 r  i+ }' p1 X
if (iedom){4 H) i/ s- V5 a/ p0 \2 k! c% j
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 H6 d6 h. c% ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 _, {+ n6 |: M& ~  ?
else, e" g4 G! d! e( r% E* S3 O* z' E
cross_marquee.style.left=marqueewidth+8
0 v0 j& `& D- k; M* S* |
; u8 C6 Y* F, w}
& s) Q8 }0 b6 }  }8 J0 xelse if (document.layers){8 `" q, N5 @; z8 H$ G0 g
if (ns_marquee.left>(actualwidth*(-1)+8))
* y- ^, }5 g( ?$ p! ens_marquee.left-=copyspeed
8 N( o+ s3 U. S8 \) F- L& U3 kelse5 l% v% u; s- p/ I- u
ns_marquee.left=marqueewidth+88 d3 P/ T' O9 g! ]% [
}& f8 W+ f0 i6 f, }- M7 J! `% D
}
( ~4 L5 z% O3 K# m/ @% c; Y
0 b/ k7 \6 C1 f, Lif (iedom||document.layers){
) |6 B9 Q( |1 c) m* k8 wwith (document){" N+ A# L8 |, q. M5 P6 N5 E6 p
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% l8 ~0 Y, F* A) H. y6 @if (iedom){
" h6 b5 f5 T$ J% w' b) D' Q* f8 T3 xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): ^- L; ^# x( d6 Z' D6 h6 k2 P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 _: i+ l1 v, M$ k8 Z  }write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ z# r4 q! P+ X# U: L- ?write('</div>')
( ]( `2 Z9 E& G' L* z- v}
/ U% [) l- Q& }# Helse if (document.layers){
4 }7 t5 c8 b6 p! Z" ^write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. _9 {& g0 D$ E8 p1 Y9 iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); [" H8 g% r6 w- I, l1 B
write('</ilayer>')
  L! q8 h9 }6 Y; D8 K}
( \. J! C+ T9 |  R0 {+ Ddocument.write('</td></table>')
& \* t* m; N2 J  j% c0 |' M}
: a& U! A/ j8 G# K3 [3 F& {6 o}) P% ^* A/ I0 L; r: n) c
</script>

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