返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 ~' h2 ?# T5 {- Q, H$ j
var marqueewidth=300( `9 f; o! G4 n* m2 g% I' @0 D
//高度
3 B! n0 v! C6 D6 D' Y' Avar marqueeheight=25
# v* R, r* H7 I0 B2 _8 z4 U" ]+ ~//速度(1-10)( V4 Y) {( _4 _- v0 B: E/ R
var marqueespeed=3
9 n) t7 ^" E% A( i" \( Y//背景颜色! _% B0 j, A6 ^/ E( k
var marqueebgcolor="#FFFFFF"
* H- R# {' P4 q! V4 g! `: Q//是否能暂停 (0=no. 1=yes)?
1 L5 ]0 o$ M) z5 n, Avar pauseit=17 E0 A1 O+ t) W0 A
$ v& M0 e6 a8 _# X5 U
//修改显示内容
, B* ^# n0 C) O- C, I6 @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! E7 ?/ h2 R- h) @
( o# S" u; u% @) S. H- K4 v- r6 M3 w8 m: c
////下面不需改变////////////
" Y( n) C0 ]+ X
* w: a( B; v5 s1 y8 @var copyspeed=marqueespeed$ B$ u* T% j# A5 s& q8 C/ u/ f
var pausespeed=(pauseit==0)? copyspeed: 0
2 f8 r' @0 T4 r+ {# P# ^, Uvar iedom=document.all||document.getElementById
5 c/ h5 x  @& j1 w+ lif (iedom)% U6 M6 q+ V( _+ P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 \/ r( `, q- m, qvar actualwidth=''
( w# L' o% l% r( avar cross_marquee, ns_marquee8 h: y8 K, c/ }) I1 V6 S
  q% D! T$ z: a* \% T* T) a# C2 Y
function populate(){8 E# ~6 [, H, J6 H  P+ K
if (iedom){
7 e' e- `+ m3 m: _' ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
  r% D! t9 o. [, Y( f/ Kcross_marquee.style.left=marqueewidth+8
3 u% k) k8 \7 ~6 e* Dcross_marquee.innerHTML=marqueecontent/ g$ n+ Q1 i5 d4 i8 V1 B) P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# _$ K" B  L( R  ]% d6 t6 E+ b}
' t0 b0 O4 Y3 O/ [1 Y7 _' g2 A2 ]else if (document.layers){
2 Z) w. u  \; Q: Y, ^) ens_marquee=document.ns_marquee.document.ns_marquee24 [: h" b; D; T5 ^* g
ns_marquee.left=marqueewidth+8
3 h7 E: ]/ P  k6 w  Ans_marquee.document.write(marqueecontent)
# ^1 q6 S  k6 T5 ins_marquee.document.close()
0 W- d) H3 X( ?' ~% B  Uactualwidth=ns_marquee.document.width: ~' c6 \& I5 H" J; g5 f: b8 i
}
! F3 g% P* \2 Mlefttime=setInterval("scrollmarquee()",20)7 k1 F4 {. b! e
}
# d3 c8 w. w- U- z0 T% gwindow.onload=populate
# t* c7 F0 c, M( n- }
4 t# ]) Q+ B* F2 {- Cfunction scrollmarquee(){
6 @5 h- Y, y5 yif (iedom){8 y/ X* Y' a# ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- g5 x2 [& M+ r/ a
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ s* t# r2 R$ P9 Y& Jelse
* g. E8 z% b' G5 |! o: a& _cross_marquee.style.left=marqueewidth+8
& z) d& r8 k) d& J" }+ K
6 I! X% t5 n0 \# Q! x' ?1 I}
" q+ Z% g7 b8 H8 _2 E0 }# R6 Welse if (document.layers){
# `* Y: k) [% C% F0 Cif (ns_marquee.left>(actualwidth*(-1)+8))' a' I; H9 J- ~' t& H* K6 e2 e
ns_marquee.left-=copyspeed2 y* d: q- [, G# p2 ]. u& q$ g) _) R
else# c) V; z: y" D6 }
ns_marquee.left=marqueewidth+8- H: ^2 W1 E. Z; u
}# q. t/ N; Q! R0 T- g0 }! q7 @
}3 }3 v* N( }" w
. j1 q3 _2 J% W, l5 I. m& B3 @/ E2 w
if (iedom||document.layers){
2 u" Q* F6 N- l1 ~9 Uwith (document){
9 Z1 W% I5 V% j  o1 N, mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! H) ]4 u  a5 sif (iedom){
, @, o, ], d. r% ~+ Xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ w1 A2 \4 E8 n6 q" t+ d
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ V/ n& T5 \) j7 x# B
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
  T( V3 y9 M7 kwrite('</div>')8 y  J7 f6 t" `  J8 Q2 ?
}
. ~! b% U' Z/ U: gelse if (document.layers){
" _! L, E8 M8 x* Z  Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 L- M/ @- j# Z! p3 \& A) {5 Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( P6 B7 a0 e. @5 b1 G5 dwrite('</ilayer>')
, }! N0 f/ I$ @% I3 P* ^8 ?}- q: Y  b% V3 c( l% B& |5 D
document.write('</td></table>')1 R% v; ?6 e9 d2 L
}
* f8 t7 ~) A$ C# ?}
+ J" j) x1 [- P. ]</script>

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