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

|
网页之跑马灯文字特效
//修改宽度
* C& ?' F% e/ h* a2 v+ v kvar marqueewidth=300: B# e: I0 {: P% I3 M* _
//高度9 X" W3 K- J2 ?
var marqueeheight=258 i: w1 a! i, ^" p1 z
//速度(1-10)
4 k# \8 \4 U5 j9 b* o* x9 J% vvar marqueespeed=30 Z" C/ F$ A% }: k o
//背景颜色
" U- d6 V) y. h& hvar marqueebgcolor="#FFFFFF"3 p, E2 _; F `% Y0 w
//是否能暂停 (0=no. 1=yes)?
' R" v9 `* V7 n4 zvar pauseit=1
. d6 d. V3 o5 s% [
# _& p- Q* U# |0 c//修改显示内容! G% L' `$ R9 w6 H2 T" ~: h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ n+ J. S# o7 g% {: X
9 R5 X/ ^9 L7 p! R
: _" L: m2 O" d/ a2 V////下面不需改变////////////
( u, ~& n) @/ y& I3 _, g8 N' h+ p& k2 p# |
var copyspeed=marqueespeed
6 Z3 i' d6 S- ]/ ?var pausespeed=(pauseit==0)? copyspeed: 0
! P1 w8 g5 q% q4 Dvar iedom=document.all||document.getElementById6 f/ ~8 m$ a/ h3 z" ^! g
if (iedom)
& ?5 f: }& O/ p0 b/ _document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 j: C8 e' K; Z6 g. s4 ovar actualwidth=''6 Y! ?. u$ x7 J0 l0 L+ B5 E4 A( k
var cross_marquee, ns_marquee0 u8 l% v( ^0 x! [- }; z: F. ?
1 n; J: a! d/ N) v
function populate(){
7 E" @. e# L! t& ]if (iedom){
( {7 x# k7 a/ g5 i7 `* Kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 g. ~" S6 Y# _' _9 b }cross_marquee.style.left=marqueewidth+8+ t' V1 b" G* Z0 o- P& Z7 d( J
cross_marquee.innerHTML=marqueecontent
" p1 s6 L- {6 E: V: Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 R f3 n; u& K* ^5 ?# q2 e' a}
2 p" [- {* F, [1 z' a% Relse if (document.layers){
0 ?! d, E" u! U- U0 kns_marquee=document.ns_marquee.document.ns_marquee2* f' c0 N* |& H. b2 Y. R
ns_marquee.left=marqueewidth+8: Q0 P. W; ?5 |0 ^2 F2 X X
ns_marquee.document.write(marqueecontent)
. t( w3 c, ]* m( @7 C7 H+ P- {. {ns_marquee.document.close()4 x" K5 D* Q' _, _0 P7 d9 }
actualwidth=ns_marquee.document.width# k0 b" E( f9 ^0 z1 q, W; E$ ^5 n
}( v+ u$ V* A4 u! `+ W2 `
lefttime=setInterval("scrollmarquee()",20)
8 N, H" U' Z7 ^( |( ]}, ~* p$ W9 @) m! N4 v U, x
window.onload=populate
5 |$ G3 n9 N, z9 O5 T) E4 g" k; d) O6 ^6 b& u( q3 I% l8 C! O
function scrollmarquee(){
# Y9 }6 W# A6 m1 c5 zif (iedom){, b* b; F4 D5 _( Q9 S. a2 i7 E, o- W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 T' a6 n& |# S- @
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 a# D6 l8 \8 Z$ i) ]) U
else t5 Z8 a$ V: C% y0 S/ ^0 M
cross_marquee.style.left=marqueewidth+8
R8 r* E, Q0 \
) b4 ~( J. ~2 s3 V4 |}
) s9 q9 d) v6 m. s7 e, O, oelse if (document.layers){9 X6 C; |% {: D" [2 P# z& [% Y+ \
if (ns_marquee.left>(actualwidth*(-1)+8))
; y( U# @# k9 O5 F; pns_marquee.left-=copyspeed
3 \# y9 ~# M# _* M1 nelse
. e% t# j9 p% \2 Ins_marquee.left=marqueewidth+8
h+ T9 f7 y$ I+ e7 H}
2 E2 ^5 X6 S8 O0 v! \. R, F# F}, f7 B" e- [3 B, d6 ^
4 M8 ]0 h; @0 ~( m6 h) kif (iedom||document.layers){
1 z+ Y0 ?& _ y% p2 b+ Hwith (document){
9 P( M6 O p* ~# X I: V* R4 [) ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 P! W# K* k6 s+ c0 j
if (iedom){- F: h i F& n. n$ B4 ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. _ B! D0 l6 {, _( B1 }% Swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 {; o) N2 z6 B: X' z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* r( X: H4 F1 g. F! B8 _/ A5 Gwrite('</div>') G/ ^6 ^0 C# J5 a8 P8 n
}3 f: u& y; B8 x9 O% U$ W9 [' |
else if (document.layers){
; J/ W* @, R, S/ {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' N% u; f1 D" Z* e0 _" f
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); `/ M. x5 W' I, N
write('</ilayer>')
* e) @( K3 z A}, K$ g0 ~8 Y: {; O; ~/ M
document.write('</td></table>')8 G) C$ x$ M1 C
}; j$ Z' {1 w' k5 ?5 \' R
}
; H+ J% Z- z' c! G( t" o- v</script> |
|