|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
. I# c' q% ^ [$ B" {) Gvar marqueewidth=300( K6 y( {# m8 f! q y
//高度
- Q" Y: A8 f2 s( U& O; J1 Y% tvar marqueeheight=25
; M8 u, J! B) H: \, \" N. v//速度(1-10)
7 ]' z. g0 D! c+ r, a8 P# o, T3 mvar marqueespeed=3
5 Z, f8 t8 C' T: e9 y+ r. G% o//背景颜色$ C; T+ y0 e# q+ y; f, E# U
var marqueebgcolor="#FFFFFF"' Q9 w# O4 ~/ c
//是否能暂停 (0=no. 1=yes)?
0 l) C4 T0 E9 N2 bvar pauseit=1, H8 R0 q; C3 n! c: D
7 Q5 }+ o0 S: T& J6 B//修改显示内容
$ a! V0 _ Y- Evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 s) f7 V/ t5 A' |
( y8 t$ l8 d7 K8 Z+ |
# f: ]9 `5 ?! L7 f$ `4 ~+ P3 h////下面不需改变////////////! E- N, h6 R9 Y2 P- R
2 w5 {8 D' D$ ~9 Q# @2 P/ E
var copyspeed=marqueespeed! R5 I* o7 V* ~; o1 x$ L& l7 A
var pausespeed=(pauseit==0)? copyspeed: 0( Y6 H# S% F8 k; Z
var iedom=document.all||document.getElementById; _; F! Z5 O5 m
if (iedom)
8 D1 a, [' p- F9 j8 S6 tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. e% V* O9 ~% r7 C% w& p4 Vvar actualwidth=''
" m0 Y8 W: {) T9 j! E. Tvar cross_marquee, ns_marquee: U A2 B1 i7 c" n$ L$ O
. P, s7 N# v: I( c) gfunction populate(){
8 H: Y5 [1 w8 E1 V: jif (iedom){
" X! o; K+ u/ X1 U+ G9 f0 a1 Qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 k6 C- d O# x3 @. \& T, q, U4 Xcross_marquee.style.left=marqueewidth+81 j/ j0 i* M' L) W& _: T
cross_marquee.innerHTML=marqueecontent
N' o0 ]0 @8 K8 J/ Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 C/ L. Z+ ]. B}
% O' e5 I2 T+ }1 T. P/ Velse if (document.layers){
% t$ _* }5 |( Z. G: A9 o! {2 b2 cns_marquee=document.ns_marquee.document.ns_marquee27 [1 r1 s1 u+ U# \$ g4 ~4 t
ns_marquee.left=marqueewidth+8
) s# M. U* i! g6 \# fns_marquee.document.write(marqueecontent)
0 S% s# d' r$ @! M2 g4 j/ E8 Kns_marquee.document.close()1 k7 v! y9 ~: ], I. c, ?9 u$ } z
actualwidth=ns_marquee.document.width3 W+ M: d( N) p5 O
}* H" B: W' O a
lefttime=setInterval("scrollmarquee()",20) Z; {$ y! K C7 N3 P6 }
}
]) J- K* u2 O/ uwindow.onload=populate
9 \$ M) |1 S! e6 j! I. r& l* i
, k( E) u4 F! M6 ^ mfunction scrollmarquee(){0 |2 \7 X4 ~" [; ~
if (iedom){3 q' s0 U7 [+ ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 @' z: G$ `. t; ?; f# i9 X
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
f* J0 s: U0 G+ felse: D6 h7 `8 m/ l* {, m
cross_marquee.style.left=marqueewidth+83 E) e4 o& K8 ~% k
* w! l- F+ v, e- }
}$ y% b9 i" _; _. f5 d$ |: K
else if (document.layers){/ x7 x. a: \: {9 Y- F/ G1 h& \
if (ns_marquee.left>(actualwidth*(-1)+8))
4 s3 O( T" ?* z; }' Dns_marquee.left-=copyspeed
- R8 I) S' n+ x* z& J& V" Kelse: j; d* l2 y; C* p2 T% |
ns_marquee.left=marqueewidth+8
8 g2 i+ \4 ?! v% p- ]" v, Y; r! u}0 B! {2 h I1 E* M
}9 Y) U# l d }' h% h7 [
$ B# a0 m1 _: p" ?: @7 T, H G
if (iedom||document.layers){
5 N7 A ~- J8 Y9 p4 J0 _with (document){
. \8 k) ]7 I8 H- ]% r* Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ y- k# i7 V: s+ l# Rif (iedom){2 n1 m) q9 A* Q4 M
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" {6 e/ v4 u; @0 n1 V, [7 Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 X: K7 C& r5 L+ e3 mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 s5 v! `; t* ?write('</div>')
# M7 I$ v/ w% e+ o+ `}
5 @- E1 m* `) y$ V8 }& \4 b" N8 U1 Ielse if (document.layers){
# R9 u% B k* N4 owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ Y* c4 c2 {, G8 \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 r% |2 s! A0 k+ X6 a9 m
write('</ilayer>')
+ F8 z* F+ U1 N6 P}5 x* X$ }6 b. Q4 e1 X; [0 D
document.write('</td></table>')
8 o( G2 B; h8 B7 R# B- K# j}; H/ e+ q2 O! g0 b
}; m' F$ j7 t: H" u! V
</script> |
|