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

|
网页之跑马灯文字特效
//修改宽度$ J$ ]$ I1 I* P- h% e
var marqueewidth=300( H$ s- ^2 \4 a' W I9 G5 q2 ^
//高度" M' s9 V; [% x6 Q, b& \
var marqueeheight=25
& m( r. b; C4 b) w6 n4 b, {1 H//速度(1-10)
' f/ i- z$ I/ t; G$ \$ gvar marqueespeed=3
6 ~! |2 W$ k' n5 q( P" a2 _/ }//背景颜色
5 g" J$ l: W w) ]var marqueebgcolor="#FFFFFF"
9 T# z' v( u* P) z+ E//是否能暂停 (0=no. 1=yes)?
/ R9 W/ ~& G9 e8 I* g) lvar pauseit=1
9 ]; r& u5 B6 e/ U) o& l
* P1 c% v' F, }. h j c//修改显示内容9 y6 j. G p1 t; ^: J( F* k
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& ]9 r" D! `" H$ q7 E& H$ q L1 o/ `0 v( o6 G& v
- L, E( G# G" ^# v2 d9 C9 I9 c
////下面不需改变////////////
1 @* K& |1 S0 T: ?1 \, Y( m8 k- z0 ^- p* J
var copyspeed=marqueespeed2 }+ L$ o$ }5 Z" i/ I$ \
var pausespeed=(pauseit==0)? copyspeed: 0
/ G/ D) @* d" V/ [2 g; F: `var iedom=document.all||document.getElementById
0 y% W( w& N0 D6 b+ s mif (iedom)
- `" X I% w$ g3 ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 m1 h5 \- X3 o2 J# i- g
var actualwidth=''
) `$ B. }# |9 f {; H0 _ Wvar cross_marquee, ns_marquee
& D- L6 ^+ A5 f
; ~7 g: s3 I# @& @) D! K7 Z0 r" R3 pfunction populate(){ `0 a4 i6 D! K% z/ r0 {4 E H
if (iedom){
/ N: i; _! Y# D* c* m+ {; `3 c; Hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ d: n! u, ?" ecross_marquee.style.left=marqueewidth+8
3 h7 m) F; x% d) K! z, E$ Tcross_marquee.innerHTML=marqueecontent, Y' ` { x# l0 o2 H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ R( D P% Y. b: G# z1 _" t}
6 [) \! n% x/ l8 |$ ]( e2 ?else if (document.layers){
8 R! E4 N* w3 k0 {% V& k; [' ]ns_marquee=document.ns_marquee.document.ns_marquee2
9 F- e1 [7 E v" \! F8 d3 h* Rns_marquee.left=marqueewidth+8
, Z" n" W) w8 U, xns_marquee.document.write(marqueecontent)
+ j: }/ l8 d: ]% qns_marquee.document.close()
4 v3 n6 r" `+ K( \/ m& u& ^actualwidth=ns_marquee.document.width; \. ~. K- A, s4 p$ c% o
}
9 D- Z0 ]1 ]: c. zlefttime=setInterval("scrollmarquee()",20)) `) i; Q8 Y7 J5 }
}" o$ n! [- x- z# D! R
window.onload=populate( S$ w9 ?4 I$ S# x) f$ o5 ^
5 o3 B; V3 F) v5 p1 h
function scrollmarquee(){8 u' ?- ?$ D0 d2 _7 O- k5 Z( P" C
if (iedom){: B; q( s+ d( K! X; W! {
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" x" R; N8 L- f: [+ j1 ~, Ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 P& A- R! V; {, H/ i0 O) x# X( celse
: S7 b/ w5 t- vcross_marquee.style.left=marqueewidth+80 X0 c; \+ @2 w, `- }* C4 {
- N9 ]6 O$ @; S8 I! e
}
8 V! x5 R0 q0 K, B m/ felse if (document.layers){
5 x/ N1 a9 x; T) p! Qif (ns_marquee.left>(actualwidth*(-1)+8))
! W! n3 Y( V& X* z. Cns_marquee.left-=copyspeed
. |) N5 h" j6 f) h! [0 D1 C' zelse
2 M) k" S" g. E" ~1 E' a% wns_marquee.left=marqueewidth+8' T& U0 v% n8 T$ L2 |
}% v2 A$ l) j* T& m' i0 I0 ?% C
}
+ ]* w/ e, y8 X7 R6 W+ ]
( a; j& w3 ~6 j( g4 }if (iedom||document.layers){
4 m& S5 [# O; \" Ewith (document){
6 i2 u& L0 u0 W8 f5 h% `document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, V& ?7 q8 k, _) W. F# d) r/ d9 sif (iedom){
5 {+ ^* g" w) x7 T: S4 q/ ~. d4 Ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' P2 s. A- p, ]. z w+ t8 d( C" fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ O. Y' ?7 t7 S% D3 _0 K7 H7 D
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& U6 W9 _# a' Owrite('</div>')
: I# f% v7 c2 h2 \}
8 a) R" o" d2 w3 `# e4 uelse if (document.layers){
$ O7 h2 t9 Z! f3 e3 b q, _ twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 H: f2 [9 t! l$ T1 q, nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). n0 T5 q4 x8 h0 [7 T+ H
write('</ilayer>')8 z2 L+ D" X0 @5 E4 I+ e
}
( m8 b& x& Y# R% @' Fdocument.write('</td></table>')
9 v' x5 v- @; n+ \- Y' b}3 _* y- }' x( }& z {- P
}
4 n4 }- @) u+ T: d- q/ H</script> |
|