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

|
网页之跑马灯文字特效
//修改宽度7 }# P* {* e% l, O
var marqueewidth=3000 l# _: @: Q$ Y9 @ H# |: u
//高度
$ N& N4 s7 W- D8 \7 |var marqueeheight=253 v) h h- `: H" b/ [
//速度(1-10)
4 e0 v! Z e2 Lvar marqueespeed=3! d. ~- b" o0 Q5 y% t) ^
//背景颜色
3 \# {) a$ W2 {& i/ m& |+ `/ Qvar marqueebgcolor="#FFFFFF"
& s! H. [5 L( Y//是否能暂停 (0=no. 1=yes)?* V8 P) ?4 H* v" R. `. m a9 f* U# U
var pauseit=1
: l6 I+ H) O1 n
1 \, V$ j L5 ]7 I: w' j# m//修改显示内容
) n! v4 B8 K, {! K+ \3 @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 a; L% _1 B9 [5 }/ Q; A: J" ^
- z! o v. g. y; [ r& P. a6 M2 g8 _/ H0 P
////下面不需改变////////////! @3 s* Y3 w T5 S) b# U6 {
, |7 v$ ?5 Z2 O% Q5 P. ~/ Y) b
var copyspeed=marqueespeed
7 k2 {% ]0 M! l) x. gvar pausespeed=(pauseit==0)? copyspeed: 0
6 c: Q% {. [) s- H) ]( T1 Yvar iedom=document.all||document.getElementById
, s9 M5 t# u7 J$ g0 z8 U vif (iedom)' T. U* o) M' h d7 z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 M/ ?2 c4 x& z7 H5 Lvar actualwidth=''3 V3 g" G3 ]! K r% `% x" b' b
var cross_marquee, ns_marquee `, V% p* K) r: N: s% b' Q; M e2 p
7 q* L) L0 C0 O/ B; v4 @function populate(){
% e4 Q- W( E, N Q! Y% h, S; }if (iedom){
$ T+ m/ x* f; @% [cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 B+ e& y/ D& B4 ^
cross_marquee.style.left=marqueewidth+8
) _+ K+ b( G* `. R4 V# y8 ~cross_marquee.innerHTML=marqueecontent: G ~. g$ b" D: N
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" ~$ y1 s3 F0 c! c, l}
) |( q( t7 m4 I$ B4 r6 I5 helse if (document.layers){) b! u* Y" v) K' h; s
ns_marquee=document.ns_marquee.document.ns_marquee22 ^- w3 M a& {# e6 a1 w* b
ns_marquee.left=marqueewidth+8
: C0 G, `& X3 Z0 ]1 I Tns_marquee.document.write(marqueecontent)7 V3 d1 _! @5 w$ G, a6 s$ J
ns_marquee.document.close()' |: A- ^$ [' ]! v+ A8 z) o
actualwidth=ns_marquee.document.width& I! r! v5 X/ }8 p7 F# |1 ?2 A" P
}1 F6 L( S7 N4 ?5 u
lefttime=setInterval("scrollmarquee()",20)& y2 g7 I4 c6 M: N* E8 `) `
}
4 E- L5 p( L! ~6 p* P" ?window.onload=populate' P" j! r g$ ]4 j6 \ z
3 \4 z2 s) f$ `function scrollmarquee(){1 _+ [$ e& `& I5 I* T. r& N
if (iedom){! ^* |( z7 L- j9 Z" g$ r* \
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( d: z3 l6 |/ o8 wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ w# C) A9 B7 h' ~4 J; d6 R0 p
else
8 ?( J6 H$ d' q9 I! tcross_marquee.style.left=marqueewidth+8
2 [4 I' e1 l$ V8 o% ]" b
+ e1 ^# r& P3 I& G: J, |}
% v4 b( c, r" [else if (document.layers){) `5 h+ g+ f* E% |! p
if (ns_marquee.left>(actualwidth*(-1)+8))' v' k6 g3 H4 }7 R; h8 o, N- w) n
ns_marquee.left-=copyspeed
: ?1 R/ Q& z2 b j* Helse" v5 ^. c0 Z8 Y
ns_marquee.left=marqueewidth+8
b0 J3 U" K0 @- `8 b4 X}0 ~6 x# @4 I! v9 b. Z* N+ c
}
* [3 U; _5 w. p+ w( `8 G8 u+ C( P- r- x: ]# Z
if (iedom||document.layers){$ C3 o. y6 P& z4 ~
with (document){8 N3 @+ J. {# D& W9 U7 H
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ o, ~% F8 G8 u7 o4 A
if (iedom){
$ A( l: S! ~' J$ R" dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
r% R% h$ `+ p# F* r8 twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ _, M- X; V4 h' [4 l0 G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 g- `/ I) M6 ~3 L( q: Y0 u8 x4 J6 Twrite('</div>')0 K1 Z d& z, }5 g3 x
}
2 @9 Q" j7 ~) s2 R/ _; \( n# selse if (document.layers){
$ {: S9 ~8 U& P$ k5 bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 j/ { I6 @ c* x) _. v, ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- R) E" E3 V% P# g, p' Cwrite('</ilayer>')0 y: I1 U D; A5 C
}& s U( M7 F$ ^* f2 y2 ^
document.write('</td></table>')
0 G1 G4 {" z" V, X# w}+ T% E- j* l) e2 {
}
V8 j* g0 r0 s$ L</script> |
|