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

|
网页之跑马灯文字特效
//修改宽度
1 c' V! Y2 b' M0 {0 r. N. Jvar marqueewidth=3004 |2 r- L/ \+ E& a( H. u+ E- F# v# A
//高度
5 N8 H# J0 C! D7 c, zvar marqueeheight=25& ^$ t9 ?0 M8 k& `# q r
//速度(1-10)
, h4 \; p/ K6 n1 K& a& Xvar marqueespeed=3
1 Q& o& R0 Y) w; {- M( u; ]4 D//背景颜色
, S! n9 Y+ Y3 @) c( A2 N) Lvar marqueebgcolor="#FFFFFF"
* \$ E- g- G6 f# c//是否能暂停 (0=no. 1=yes)?% r3 w$ `9 @* f
var pauseit=1, }4 d: X$ P9 ~& n8 l& _& Q
, Z* U: S8 X) G& l//修改显示内容3 c9 I( p: N) V% A- ]# m
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, T; S/ H7 n7 |- v
1 N! h* q N G' o) n9 R. M& m+ G0 i8 N, {
////下面不需改变////////////6 u; S5 x* G W9 Z9 H
! j# s; E7 f F7 evar copyspeed=marqueespeed, x! d. l! |# |; _
var pausespeed=(pauseit==0)? copyspeed: 0
5 o* [- G) v- fvar iedom=document.all||document.getElementById z& U8 K4 I( f+ g
if (iedom)6 O# [3 U+ m% Q$ n! `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): O0 A; S, R- U+ S! j& c! L
var actualwidth=''
& }5 @& U/ |% }8 a4 C/ {( Svar cross_marquee, ns_marquee
& s, q. O9 Q- F0 u! E/ i( _
2 k" F) a: f0 Rfunction populate(){
' G- }* W6 I. y6 P) g- Q8 jif (iedom){5 @8 c* T* d8 K& V1 i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' @: Z1 w0 s2 ^; t0 d) b1 ^0 {
cross_marquee.style.left=marqueewidth+8& @. g$ Z# B! r3 C4 K# T
cross_marquee.innerHTML=marqueecontent
% `' Q# N* O3 r/ {$ i& _, K& bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) f b0 Z! T6 r8 i" `3 \& w' B
}' L: a# G# C! N1 k' |/ C
else if (document.layers){
" O# G2 Q: u$ U, s" ?+ Xns_marquee=document.ns_marquee.document.ns_marquee2. c3 K! R/ ]* ^3 \) z
ns_marquee.left=marqueewidth+8/ E$ `) ]0 v; D
ns_marquee.document.write(marqueecontent)
6 a% R$ O$ v) C! |( ^# k1 t7 dns_marquee.document.close()
. ]) d% w% z: `: aactualwidth=ns_marquee.document.width' R( D! ?. K2 I
}
f* E% y$ `* d. N) q1 Flefttime=setInterval("scrollmarquee()",20)6 v2 t& P- ?! G
}# f$ @, D6 w$ _* f) F. T
window.onload=populate
7 _' e J4 K! C( U4 r5 Z/ ^! W; h" k* D% d0 Y- c9 a
function scrollmarquee(){1 A6 b$ `+ h% ?7 P0 s2 g4 A+ H Q) T
if (iedom){
% v$ L8 S4 j/ {( k3 G ]1 Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* J$ s8 m1 \9 I3 z" N- \cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( X1 l/ N7 ^' e' R. p$ k$ S1 m/ l
else# _0 p0 C0 C" d$ @5 `7 A
cross_marquee.style.left=marqueewidth+85 \9 f1 R) s: f5 O
( z* J; F1 b! n1 s}
+ L+ N& Z* ]/ x6 r' V+ z: E5 Welse if (document.layers){
4 m; D( O) f' Lif (ns_marquee.left>(actualwidth*(-1)+8))
, z# c! y" u# W! P- Z. | }ns_marquee.left-=copyspeed
8 L6 a5 t9 E+ w: \; [5 pelse
7 s" H# h9 ]- S2 P" F- r# @ns_marquee.left=marqueewidth+8' m* y) M1 U3 L. d' k
}. \' S' S% G# G, q# ]$ l4 {; q
}1 I* O9 \: O. R' p" z" [! ~
. F0 T( }/ W8 K n$ ^
if (iedom||document.layers){5 B" t+ E5 P0 c5 W; N" e2 v6 I
with (document){; `: I5 O7 v4 d" y9 {. a: w. S9 c
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# _+ j c! H s0 z; ]* F
if (iedom){' M8 `- v. [$ k+ F6 i8 a
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). G2 R3 r& _, D0 o/ `3 h8 o# F7 w" |
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" x- ~0 K% d5 y2 z* y- s7 ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
7 D8 }9 ~* n) H7 a& fwrite('</div>')
" L( e- ]9 h( ~9 B# \+ E1 a) }2 r1 k9 K}
9 [# P5 e( T# f$ ^! X s- G. lelse if (document.layers){
1 S) b9 |/ `2 ^2 ^* p) O, u; _write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; S V5 P3 x/ Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( }2 k% A& K8 c/ p1 B, W5 S
write('</ilayer>')
5 j/ X/ w/ V1 T8 O* q}
! r2 i n. H+ T" d( |document.write('</td></table>')
! a# x: h+ o$ c}
3 S2 {) S5 ^+ J/ S5 b}7 p3 u7 H+ O7 D% F4 v! C. e5 [
</script> |
|