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

|
网页之跑马灯文字特效
//修改宽度' q! L( Q9 {% k# H% R* C7 @0 a
var marqueewidth=3003 Z; K. I9 C$ X3 n! D
//高度, Q4 t, Q: L0 i/ C; Y' z
var marqueeheight=25
6 J0 t. ?* @ |) Z8 E//速度(1-10)1 }6 I, h% A) ]9 r
var marqueespeed=33 |. X9 ]7 y1 w7 b5 ?0 v, \
//背景颜色
' h$ E0 P) x0 z: F$ e' i! Nvar marqueebgcolor="#FFFFFF"
! O! F# S7 W7 q1 L//是否能暂停 (0=no. 1=yes)?* ] x/ Q& t# S2 c
var pauseit=1. [9 k- _% N" X3 v" {; L0 R2 f
* A, U- F7 {5 i2 A. [2 D
//修改显示内容
8 g( J1 @/ g" R( i( s9 F6 zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 X c2 ]% K2 Y: W }7 S
% A2 l! J3 d1 u- g
+ d) X( e$ `5 w% i////下面不需改变////////////6 U* N! A) _8 ?
6 |. a3 z& t3 x) y8 Xvar copyspeed=marqueespeed3 s ]: V# W- s ?
var pausespeed=(pauseit==0)? copyspeed: 0
# ?( X, w+ E9 c2 \$ h6 q: }; Hvar iedom=document.all||document.getElementById1 z! n' Q- b% T
if (iedom); Y' I( _! S: `$ m4 p7 c& b
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 ^ l: Z T7 E% v- \$ m4 g5 nvar actualwidth=''8 a( h3 x+ [( X% y) z3 N
var cross_marquee, ns_marquee1 {6 s+ K% y7 K6 [: @
1 }5 k4 x4 a6 y8 t9 n9 l! Z6 C/ _, Kfunction populate(){5 T6 t4 c* N3 [' F$ x
if (iedom){# i, e8 ` L6 @* @' s9 J0 S0 Y: Q' d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, D1 a+ t7 i5 ~& O- ?cross_marquee.style.left=marqueewidth+8& D2 I P4 L5 H- p1 n$ q# U' Q
cross_marquee.innerHTML=marqueecontent
, h' q/ t/ W- d4 m& `# Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ O3 d' B! z! z m- P5 E& {4 D4 R}
7 v% H6 K5 w* k* `0 uelse if (document.layers){$ h0 B7 Z$ A- z: S% Q
ns_marquee=document.ns_marquee.document.ns_marquee2, G/ m* j2 l- T! p4 u% ?
ns_marquee.left=marqueewidth+8, W4 L8 ^# }' ~) Y
ns_marquee.document.write(marqueecontent)
4 m0 |5 K- }$ K+ e9 x- U1 Q0 Vns_marquee.document.close()4 W) S; S2 ~& ~7 i" I
actualwidth=ns_marquee.document.width4 P. {4 q6 P3 y& V9 J
}
5 I7 n' S1 Z- b- Vlefttime=setInterval("scrollmarquee()",20)
4 {5 j" O$ @$ v, c/ Y% P" S}
8 a9 F3 A1 C" wwindow.onload=populate; S' i3 ^; [# {( X8 E
# f2 L8 o9 f, B5 Qfunction scrollmarquee(){
1 j+ w8 B0 \& U$ h1 P1 Xif (iedom){8 `, W7 T4 g+ [0 n
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 I- U7 X% k% S' K
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
W* J* p4 Q* x: Q( Helse
3 L3 p0 h3 F$ X0 {) Scross_marquee.style.left=marqueewidth+8
8 U" M8 J* W8 x1 E# l1 |" ?3 E4 K# A; V7 l2 k6 v
}
# p1 Y; U) v- e+ celse if (document.layers){
/ H7 e! t7 b+ Yif (ns_marquee.left>(actualwidth*(-1)+8))9 t8 i. |& w7 b% A8 ^
ns_marquee.left-=copyspeed1 a7 r! A6 }/ I3 r6 k- `
else
9 j3 c& p7 ~ Ons_marquee.left=marqueewidth+8( {; o# Y7 K- j$ c
}
J2 y; o3 R$ [& T% Q; m& t}, m9 I$ S# n0 s P% M# P
1 j( {7 r" i S& r O4 bif (iedom||document.layers){
6 h' {! K+ O4 k5 d1 o( V- _+ E- Jwith (document){4 F% w0 U( f- c( P" Z! K
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! ~" A n' `4 D/ a% d- ?if (iedom){
j3 j" d4 h7 q( c6 V7 g7 hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. }) {* }) Z3 k$ owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 K- R' p, c# z( s$ kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: Q5 I8 z. |! R+ q6 H. @write('</div>'): D# I' a& V7 t% a9 d- L
}
1 h; j1 b- |- J/ B8 D6 d* }) @/ h6 Y6 {else if (document.layers){
, `- |! S$ r- K* [. ?write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ z) ~) q% t+ _2 _& I ~: G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): d5 T( ^* e! C1 D) L
write('</ilayer>')) _" p) S2 ]" E I( r4 K" }
}
, z1 M; l0 W' E% ]4 \1 |( l/ ]; G1 pdocument.write('</td></table>')
- E3 D2 u) v$ m1 l% v}2 t3 p6 {4 {1 t+ k, s6 D6 J" y
}- f* H! k/ e: b& ~
</script> |
|