返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% s$ z( \, v  C+ b" J3 Nvar marqueewidth=300. B/ `8 h; H4 c+ {! i. u% v% L
//高度
. J4 q& j" I! |8 b. X% Uvar marqueeheight=25# s  H0 O8 L+ B- k% c
//速度(1-10)4 S+ @) M) s1 e2 z8 H. I( l& ?2 e
var marqueespeed=30 p5 M& o# [) a
//背景颜色  e- Y3 m4 O: m
var marqueebgcolor="#FFFFFF"
7 z; @7 M/ S6 z6 X+ d//是否能暂停 (0=no. 1=yes)?6 Y" M+ V9 u6 X# Q# r- m
var pauseit=1
5 M2 c$ O' ^4 y* Y2 y3 n# C+ B4 Y2 `+ U
//修改显示内容
6 @- }' ?% U+ i3 F) V4 Wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 C8 A/ ^: P& \3 Y3 ^* _
) L$ L: E  i/ E
% b( M$ ]% b$ \% ^" g
////下面不需改变////////////
/ [7 V' K. e6 y. K7 p7 I. G8 X- j* \( e# S) x
var copyspeed=marqueespeed
& E2 T: T8 ]* F+ {var pausespeed=(pauseit==0)? copyspeed: 0
# H$ c4 b& P3 f) |, N: ivar iedom=document.all||document.getElementById
) r6 G) [  V$ Aif (iedom)9 C3 l# L8 g4 M! n# y) X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 @( U0 w! b+ K  j: _var actualwidth=''
) V) A0 N# i# b$ ^& r9 kvar cross_marquee, ns_marquee
2 K/ x0 U! X) A* D+ \/ S) ]* o5 W# E$ w7 z
function populate(){! @/ S% B, U7 }- M. t. ^
if (iedom){
% o3 x* I& ^; |) tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 d& f, G* ]& ]; Q9 [cross_marquee.style.left=marqueewidth+8
# V7 V9 F) z8 B- Ycross_marquee.innerHTML=marqueecontent
. M2 m5 W5 r; H4 e* W7 ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* M" J5 Q6 W6 G' f- j7 _, r}6 E, {: M8 I$ s4 |
else if (document.layers){
* K+ l6 q% P$ Q" ~4 \1 ens_marquee=document.ns_marquee.document.ns_marquee2
) q; p. C! J4 B. uns_marquee.left=marqueewidth+8
: G/ ]& o  [6 l9 a  Yns_marquee.document.write(marqueecontent)
+ ]' w' p+ X. w4 P  j" w( ~ns_marquee.document.close()7 p8 C: U4 G3 [) a4 I  v7 Y
actualwidth=ns_marquee.document.width6 `; K0 b: C$ ~- N# X, A. \& g' K
}; ?) p" r7 W& N& B
lefttime=setInterval("scrollmarquee()",20)  P( ]4 ?) q; T
}% z  Y; u) B1 j2 C2 x+ Y8 B2 [) |
window.onload=populate' i0 M5 T0 ~) T  C9 z2 Z& H$ T
, w1 q0 r$ h+ m( x( ]8 H. Y
function scrollmarquee(){. @4 M" D% w- D2 r. L
if (iedom){
5 ]' A' h2 G1 S$ W# qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* ?: ^& m/ w' \' z5 c' }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' A1 _6 ~: X: aelse
0 ]: h- {* W0 c" Z* \9 W; ^cross_marquee.style.left=marqueewidth+88 C( U  B) ]* l4 s* [1 B

' n$ \& z- \- p; Y1 D}3 {  |/ o1 D  m9 M( h# W" M
else if (document.layers){
, e2 p/ Z+ m4 [# m2 a9 V; K2 }1 Bif (ns_marquee.left>(actualwidth*(-1)+8))
  c, [3 |+ ?- s& c2 H- jns_marquee.left-=copyspeed
3 o( h+ ^7 ~+ Z; Q2 n8 G6 ielse
+ a1 @0 ^( E, M6 Ans_marquee.left=marqueewidth+8
0 w8 g" z1 K. _# }8 X/ P# ?7 H}7 f' y' ^$ t, q9 J: g. d& n& x/ D* u' Y
}
4 a. r5 S+ o- D% ~( a
, w  K; ?- q' ^! U/ e8 Tif (iedom||document.layers){
8 T, ]  F" h* G1 |- Swith (document){
, C5 F+ L$ C6 C, y! w2 `0 |document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' ]9 V! v4 [3 l* e  k$ E1 @; k1 Oif (iedom){6 `/ J5 D$ r4 ^6 R, f- G/ p1 b
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 o1 N. ~& x1 gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')  `5 @. G$ I0 w* F* K2 `
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 w; ?0 h8 ~: z3 k, S  B& A
write('</div>'). E8 G! j. I. r# t
}
( |* f4 S2 k3 u' J' s/ `$ s. \else if (document.layers){
5 N, @- L# O- y1 b2 O  Qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) ~6 d9 ~4 G$ t7 N
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): w- \0 ~: }0 Q' g1 P6 b" K- J
write('</ilayer>')
# |7 {3 w% ]/ w8 L0 q# b; g}
9 N: k4 u5 A% @( D# N1 L* o% j# Hdocument.write('</td></table>')) q7 a3 Z. K% t
}
4 b6 W" a* p- b" b' K2 M}5 J& y' f9 ]( P! n  _1 |; i
</script>

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