返回列表 发帖

网页之跑马灯文字特效

//修改宽度
7 ^0 {  n9 W/ X4 o# Y: s1 avar marqueewidth=3008 @2 F) R4 ]6 Y5 ?; e2 h/ Y# W" x. }
//高度
" g$ Q, @* @1 r  ]' q) c% ?& Nvar marqueeheight=25$ p: \4 ~) b  G
//速度(1-10), Y' [) j1 m% t/ \& O
var marqueespeed=3+ q- _9 t. k. l' ~  v1 }
//背景颜色
7 E, u4 Z1 y1 z) E* [3 {7 Wvar marqueebgcolor="#FFFFFF"$ Q% i* W/ L# D$ g8 f3 k
//是否能暂停 (0=no. 1=yes)?
- L$ @* m# {  ^. G, D# lvar pauseit=1) q( z3 Y3 \2 I% Z8 d7 d, J
( h/ S! r! l+ `8 y
//修改显示内容
" c  o1 E. C. [9 T5 uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% t& g0 ~5 w1 @/ p
) t! R2 D# `! n( {; i

* L' ~/ z5 O4 [7 T8 ]+ o////下面不需改变////////////6 W4 U* l: |1 c, `  i+ J' j
; V+ y2 N3 B. n. I  F
var copyspeed=marqueespeed
- H4 E7 R* l% z1 q0 M" Tvar pausespeed=(pauseit==0)? copyspeed: 09 X2 [7 z$ ]3 V  T+ q4 \
var iedom=document.all||document.getElementById& e0 K+ ~( V- }6 p# w5 {
if (iedom)
. x) q2 g1 Y0 u# @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 ~) n3 w4 z( t5 b) v
var actualwidth=''% d4 ?4 k! Y! L, _* e1 `
var cross_marquee, ns_marquee
* a1 i7 [; H1 g  @9 L, y; P: @' l4 V9 l9 a  ^2 K- n
function populate(){. p+ g8 @% w: K. _1 ?+ m( u
if (iedom){
/ w: u' C  J' T) Q: x, A: |8 Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 q1 ]2 |3 a1 ]; {: ^/ v0 I% V9 icross_marquee.style.left=marqueewidth+8
8 C+ }0 K8 Q* g+ u) ocross_marquee.innerHTML=marqueecontent
% H3 V" j8 r) v! gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- D# d2 f# ?7 z8 T1 |* W
}
1 U" r$ ^! U" V+ ]& p( `else if (document.layers){
6 ~% [: p. R# n4 w" s4 L# Rns_marquee=document.ns_marquee.document.ns_marquee2  M  Y6 t1 h0 Y, w2 U2 f7 z1 ]$ w% H
ns_marquee.left=marqueewidth+8
. w4 x1 X, X+ |ns_marquee.document.write(marqueecontent)1 J  U* w. _  [% ?: X
ns_marquee.document.close()
2 \, _* q; j  y& v, {actualwidth=ns_marquee.document.width
( V; f7 r6 O) w9 z4 w" ^}4 N; c3 q9 n0 b) k
lefttime=setInterval("scrollmarquee()",20); m4 A* G. Z* a+ S: k
}
: h. k2 l$ T. k: U) L, E" {window.onload=populate# K/ M. s8 V9 E+ \
6 h! Y1 f) w% n$ d$ _7 _5 K
function scrollmarquee(){
1 ~0 ^% ~9 U1 P' sif (iedom){# V1 O, |. x6 ?; ^1 S& b
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. z6 B. u4 S& v- P( a* J( bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% f' \  E) t) f! [/ velse
: e6 v- G& T/ Pcross_marquee.style.left=marqueewidth+8$ t2 X! c9 m6 B# r* i0 Y- i, [

# y' i  Y/ L- k}" Q% o  p! m' |/ i5 O
else if (document.layers){' q; W1 W# f* {( F+ J0 b' F
if (ns_marquee.left>(actualwidth*(-1)+8))9 ~. a% ]  r( k# n- o" }4 s- O( U
ns_marquee.left-=copyspeed. g7 R2 T- R0 P/ u! r! t
else- b& V# Y* B$ Q$ m+ v
ns_marquee.left=marqueewidth+89 K; h3 u! L, A$ v; r
}
; o6 Z  F) L- g5 U- L4 E/ ?}+ s4 N# D) ?4 d7 l3 {+ H8 J
( M8 b# O, M" C7 p7 T% A
if (iedom||document.layers){6 S0 ?! u9 e) R7 K
with (document){& T/ A5 O: C- R' o1 P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% B* y' l0 h4 ]" `. p
if (iedom){
/ Z* p. Z% z8 Ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ I& y; D. Y  k& f3 h" r
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 c7 H0 P+ x1 _write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 l% J6 {9 t6 {$ _3 R
write('</div>')
0 G1 H/ Y( S1 G$ S5 {; M" s}  }( w! f1 {# Y
else if (document.layers){
* z9 k' H4 e. H" v/ b* U& h' r( Cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 T1 {0 K9 G: m, K/ M8 [3 E% r% swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 L; {& U% M* u  n- G- f8 ]write('</ilayer>')
% D" U" s1 {2 H}
7 y2 ~1 x/ }" F  B1 ]- |& wdocument.write('</td></table>'). Q1 F3 l" w# w: [1 S- v+ \
}$ _. u9 O& B/ n9 w9 \  m
}, D( s4 U+ y( l
</script>

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