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

|
网页之跑马灯文字特效
//修改宽度: P9 a/ `* ~% I" c; L& S. D
var marqueewidth=3005 |5 U. @* s4 {- f; C" @% u/ q; A2 H
//高度
+ K% e* P6 w9 z8 Lvar marqueeheight=250 R. V1 a2 x4 M, A. k. U% w! T
//速度(1-10)
1 ]( i7 c* A: R7 Uvar marqueespeed=3" v+ Z" ?! }' j
//背景颜色0 Y+ r3 G% ?2 u
var marqueebgcolor="#FFFFFF"& z& u% h7 M; E; |
//是否能暂停 (0=no. 1=yes)?* h+ }2 x+ B9 T& {) ]
var pauseit=19 D' `. I& _2 `9 ?, \; x! X3 |# T
" }: m# Z3 b9 E; C3 i q: S7 ~$ d
//修改显示内容
. X3 ?0 W. p. \$ R, `& K$ O0 A; Avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 h3 N+ K& C; U
3 m7 y8 W6 u7 F. ~
0 `- V: T! ?0 m////下面不需改变////////////
* ?6 d. R$ V* U! w! u, \$ Y( Z8 ~: d; [& _9 D' u/ p- }7 q9 H; J8 d
var copyspeed=marqueespeed G: R& i+ |) _0 j. ?% `: S
var pausespeed=(pauseit==0)? copyspeed: 0
_% H! Z: a* S5 A, c( l& S; A) h! `( ~var iedom=document.all||document.getElementById' R) M; v( a3 q) y' W2 }4 G8 {
if (iedom)
% b' @. T6 a: `document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 \& o4 h! F& j6 N4 y- Jvar actualwidth=''
1 y2 R2 J: m4 `. xvar cross_marquee, ns_marquee) I1 O( \: J% j/ M
. {% x) x1 {3 T3 w- y# B" Zfunction populate(){
8 K* L) r- y' n# V8 gif (iedom){
* Q2 ~; w+ H6 R0 X6 }) {cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 f* A; g+ e% z* scross_marquee.style.left=marqueewidth+8/ f+ I6 C* ?" g% O1 z# B! B) O/ z
cross_marquee.innerHTML=marqueecontent' \$ A3 d1 v/ y- I3 y5 x
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: U5 H. g( |, N1 J- h}
, M$ v0 f- L1 [# L, U, J7 M/ B* d( x: eelse if (document.layers){9 S7 F) O% A) W
ns_marquee=document.ns_marquee.document.ns_marquee2! p" n A: h2 R: K
ns_marquee.left=marqueewidth+8
6 c$ W; k+ t/ `$ Q* Uns_marquee.document.write(marqueecontent)
: Y- e6 m! d; r# X X' D2 g4 \ns_marquee.document.close()6 p9 X3 X3 ?' z) Q7 o, Y! v
actualwidth=ns_marquee.document.width' h2 l/ a& h* n8 \8 `+ O
}( U- u$ A! x3 w3 X) @5 }& `6 v
lefttime=setInterval("scrollmarquee()",20)
) ?& L. S% j4 h+ g1 J2 ]0 S}
& d- O- h$ G3 Y1 Y6 I9 dwindow.onload=populate
: k' ~1 x/ |; O+ j6 E( N3 O/ \5 `& A3 J% K* G6 \, m
function scrollmarquee(){8 Y# e+ `4 ?6 o! K' {
if (iedom){! z8 M) W- z& o4 C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& O9 G9 o& e8 G* X H; y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
Y: v# b& S% Z1 o5 O \; N$ }else% ^5 U1 A; z; t) i" P4 e* M
cross_marquee.style.left=marqueewidth+8
5 r: ? k; P$ L
& m8 v; l1 a* j2 W5 m% r/ q}
4 d. m8 O, W, G" ]& A1 v1 ~else if (document.layers){
* f9 |3 A% e4 n! aif (ns_marquee.left>(actualwidth*(-1)+8))6 R5 I( W' k P9 Y$ N, X7 E
ns_marquee.left-=copyspeed
; N4 w& k2 o4 Z- c1 melse
* ^/ M6 P& b: }" A% C5 m* w' ]1 dns_marquee.left=marqueewidth+8
4 K& @6 D5 s; B! O A1 r+ C8 E) ?7 V2 t}
8 r- I6 v" {% c1 [) D& Z}
7 z0 A( E$ Z# M% `7 h% H6 \, ?( q( t+ ]# d7 `6 g
if (iedom||document.layers){
1 r0 n) X |7 R; a bwith (document){" ^$ u+ d$ o! a" e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. B4 ]; E' j6 K. R+ @! h" e k# ^if (iedom){1 k4 G% _9 O# H! X' y, [
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 \1 o# o5 P# b1 J! F! z1 ?/ pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 a7 v' H; L3 F' u0 d" ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ `7 [$ W( ~2 w
write('</div>')6 [ T2 \: g9 ?! p9 Q
}- r3 a5 T/ Z% C) V. |
else if (document.layers){0 J$ h: M5 Y" \, u8 o N
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& H) N# ~: c( \+ g
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) Q2 M6 G7 `4 x! Xwrite('</ilayer>')
d# P5 Q% K: d7 Y& K}2 `0 @/ Y* O6 P2 Q- B
document.write('</td></table>')+ r) _: a; x3 S9 l9 x
}
5 w. o: D- D: L4 z( q' X6 @6 e0 [}
H4 ]1 Q3 S$ y& Z; {3 p</script> |
|