返回列表 发帖

网页之跑马灯文字特效

//修改宽度
; q; M8 q9 c, R" @var marqueewidth=3007 }1 [6 Y$ H7 A1 z
//高度* m6 V* l% ~, r6 B
var marqueeheight=25
( F  C6 U* m' w# H8 X//速度(1-10)
8 s8 s9 J5 K. B9 Lvar marqueespeed=3
& _* S  N( R' }) M( d7 H- y//背景颜色
3 s0 y) J/ L# ~( Mvar marqueebgcolor="#FFFFFF"7 Z) w% o' f; r# C
//是否能暂停 (0=no. 1=yes)?
( E# _# x4 ?. |5 L% f4 q$ uvar pauseit=1
; J& t6 d7 y3 N9 X
6 U8 Q6 u, m; K2 P2 f4 i//修改显示内容7 V4 J: }) J8 W% H9 Q; C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': e; o# |8 [0 |: O9 {: s# m  N# j$ g; R
1 U1 ^6 z2 D% p7 T4 i4 F4 e

# l8 q) V: E( q! L, w! P; K: \; @% l////下面不需改变////////////
/ R2 I9 k2 ^4 _" Y4 i
1 v# h* M# |) F8 H& |0 Hvar copyspeed=marqueespeed2 R' C/ j! m. L
var pausespeed=(pauseit==0)? copyspeed: 0" ^3 X5 Z" J, p1 Q
var iedom=document.all||document.getElementById4 d; l! k4 \0 G& A) v  I9 R
if (iedom), Q8 ]0 k; _9 i1 L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' n! f8 J# i$ @" c- p# r/ Pvar actualwidth=''4 t3 T; z1 Q& t. q( |0 ^* s4 t7 O0 V, {) J
var cross_marquee, ns_marquee
5 Y' ?. V  E5 S) U: F0 G
) M; O' l* `, dfunction populate(){
9 g$ e3 `5 w& Q7 Y: fif (iedom){
! j1 Z  c6 ^* u; }7 wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 ^. t5 C& r- c$ Z4 L. T0 Ucross_marquee.style.left=marqueewidth+8
0 ^# c4 H; p3 a6 i( Lcross_marquee.innerHTML=marqueecontent3 m5 j$ K- q+ o& i: ^# K
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. N0 U7 L2 [* _0 L$ x}  b- X# |& V2 e! d9 z0 `
else if (document.layers){+ W1 r& l- l- b: m
ns_marquee=document.ns_marquee.document.ns_marquee2
  T$ @. \; H; F$ P' Qns_marquee.left=marqueewidth+8) O1 P8 j% L" i# y) b
ns_marquee.document.write(marqueecontent). G" r2 n! z+ }, i8 F9 X
ns_marquee.document.close()
6 ?" D/ K) C$ x" {' Nactualwidth=ns_marquee.document.width# [& {/ U! j3 U8 d; [
}
/ Z" Z  P. b% V2 ]! H2 f8 Hlefttime=setInterval("scrollmarquee()",20)8 }" n9 I3 ^4 N2 x. D% x
}9 f2 N* o5 l: a0 C' K! I
window.onload=populate% B. c# j/ ?4 X) o) h- ?

7 Y$ Q6 G0 v# q5 ^) @function scrollmarquee(){
' I' }! ^/ A1 Rif (iedom){" l! z, W* g. \' E: o
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- x- N( `0 Y! s- Q- R. k1 O" jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 g5 d9 r# `" K' Pelse
: M/ I0 C5 E/ ~7 @: {cross_marquee.style.left=marqueewidth+83 \  N4 x1 i! h, k
8 I# y+ \! L+ s) a; L0 ^
}9 @; \+ I: t3 U
else if (document.layers){/ J$ q# y% t' X, O5 A
if (ns_marquee.left>(actualwidth*(-1)+8))
  A7 A! w) ~7 J8 ?% Z7 vns_marquee.left-=copyspeed
  Z" G9 w0 N0 _. uelse
$ @' Z! j/ i% Q& Z3 X- z* ?ns_marquee.left=marqueewidth+8' @/ }+ f+ z. [. K
}, u0 [7 E( C( ]6 M$ q- y4 Q7 M
}
' Q! R- ]. H, R. K5 k7 t5 d( Q* W
' |; o  ^7 y% l$ v4 K1 xif (iedom||document.layers){
6 F. S# }, p. T  twith (document){
- S* F( L6 {  l, ~) @, Kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 I: v$ F: K: l9 Y' W: i
if (iedom){4 ~4 V' P/ ^: M1 @  D
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% V6 d+ t* {" \- d& kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( a; A+ r( b1 D6 i$ z" q6 q" w+ L% N
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ ]3 Y5 _, n+ C5 ?; P/ \# f* c: O9 \
write('</div>')
7 R+ k: [( z' X; M}
5 x4 ]; k1 M. o+ ~0 ^2 D" Relse if (document.layers){
$ M7 t4 F1 ~2 f( q! O$ g8 d4 W; gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 e  k" i+ O- E; R: c* Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. W  C! M* w) e1 W9 H5 g6 p3 |9 bwrite('</ilayer>')
( C$ ?9 H  `! L5 s' i! r* b1 E}
+ @; v$ a1 x/ X) bdocument.write('</td></table>'). G0 T) u% W, Q
}
5 K! P7 H2 X2 L/ @; ~' r}# Q5 V7 b8 X7 j; P4 |. j3 y
</script>

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