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

|
网页之跑马灯文字特效
//修改宽度
: |4 d4 }+ \ \# `var marqueewidth=3000 |, l' H7 T8 C- J4 s
//高度
/ g/ Z, O% I* [8 K/ f& {var marqueeheight=25% P! J1 [6 ?# k9 z" v' _% }3 b7 ]4 Z. d
//速度(1-10)4 R) i2 m( L: \6 Q5 p1 g
var marqueespeed=3
$ R$ e) ?$ z# x3 m/ M5 {9 A//背景颜色
" t5 F; i% [ a6 [" kvar marqueebgcolor="#FFFFFF" Z9 {0 p t. f) |
//是否能暂停 (0=no. 1=yes)?% n1 ^% L. a3 ], x! T
var pauseit=13 T) g7 Z8 O4 n! P' J
* h; P+ [4 i o8 n* K; g7 `
//修改显示内容
0 s' o. h$ Q, T1 \2 K: p& Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 v/ E5 j$ Y- {" y% u1 ^/ q
/ A: g6 z% n# A$ @. m2 s# L5 r( j, g# R) X2 }( F
////下面不需改变////////////) \- Q" f2 n! ^& d F- c& z4 ~
% s R' E2 u6 t( `
var copyspeed=marqueespeed& ~- v1 a7 v' c9 ?" x( K( _
var pausespeed=(pauseit==0)? copyspeed: 0' q- M4 v& C2 O! p# q! K, h
var iedom=document.all||document.getElementById/ |2 B- t. a" S, y5 w0 m
if (iedom)
# z* K& N8 j6 ~; T6 d7 G6 odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; h) B8 G) v7 x+ _8 R( Pvar actualwidth=''
) j, w& @" g4 T8 m# Fvar cross_marquee, ns_marquee
6 P3 g/ V8 W0 ~' n- \( v& g
5 S% l- n4 Z+ I: {. |5 w2 o* o ]function populate(){* ^* _: A8 Z: B D1 g
if (iedom){
& ?# e/ Z2 c- Z* fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; f$ d/ a( V2 I5 Wcross_marquee.style.left=marqueewidth+8
- B9 T- k6 G6 L* E% W2 Zcross_marquee.innerHTML=marqueecontent6 P, _9 |! e. f
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! w1 S4 l0 @- p$ y6 r' p
}% F0 @- j6 O2 N/ X5 |6 M
else if (document.layers){
8 e6 _9 |2 [3 B, u6 }+ cns_marquee=document.ns_marquee.document.ns_marquee2
# q% E2 |0 N7 B; ?ns_marquee.left=marqueewidth+8
0 f0 ~9 m$ L" H L. M/ Ens_marquee.document.write(marqueecontent)
$ m8 m, j# B$ N% Ins_marquee.document.close()
! @9 K, N% V( K# wactualwidth=ns_marquee.document.width
* U* x, e3 K6 Y% f6 D}1 L' K6 x" ?% c) m$ M9 J$ D
lefttime=setInterval("scrollmarquee()",20)
) v( g9 n" j& m}* m# g, X! S q3 \3 w, D% T; p( [
window.onload=populate
0 h4 S) k9 _1 ?0 ~# ~9 p
# L+ ^, {3 T( ~" s- |function scrollmarquee(){: ~; z( m2 I& S
if (iedom){
1 b2 ]( { d! Nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 y1 Q- ], @) J3 v @
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ n. A2 t4 Y' k$ {. oelse* w9 u+ k9 L) ?: J( }
cross_marquee.style.left=marqueewidth+8) A* ]/ W; J+ j" V
% h- G! b0 Z0 ] w7 R1 ], L2 I! h}$ n0 _2 \) |0 ^0 O+ @
else if (document.layers){
9 n0 f7 z5 `2 B3 N, lif (ns_marquee.left>(actualwidth*(-1)+8))
3 X; u# t% B( p) Z/ j$ ?. F2 n( Lns_marquee.left-=copyspeed! D6 E! X$ r0 \1 @
else! i4 K4 s$ a4 Y) u- C9 ^
ns_marquee.left=marqueewidth+8
+ T5 R) @/ s% s}
% X1 o; C k% q; V9 q& ]3 }}) ~2 J- E, R- J( |+ ?
+ ?" W$ K5 F; K( V+ U2 d9 q
if (iedom||document.layers){
# H7 T. @" b0 t- p/ A# ^with (document){! \! r8 D$ C7 e, V2 D5 I J7 q. }9 I4 v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 E; f0 H7 _& A) j' M) z* n
if (iedom){
) }9 {- n) \. i# s1 \write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( l ?" ~/ r' p* }& R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- F: ?7 w( Y% q: [# ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ ^, ]/ T: c* [0 A
write('</div>')
! f- T3 g5 I0 U6 u0 s$ B$ r; W}4 ^: E) ?2 ~" b& U ]
else if (document.layers){& |/ \- K. H( W7 G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 M" T: S$ Z( f8 p1 _0 ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# F, k% t5 Q Z
write('</ilayer>')
* @+ G* X$ x( D6 u: Z} M4 ~" \! `& y3 _7 N
document.write('</td></table>')
/ E9 h- Y! }- c' a4 x% w7 D, Q}: J! \; T. }8 z6 T' G
}5 w) g. G5 F, g9 U+ f6 o
</script> |
|