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

|
网页之跑马灯文字特效
//修改宽度
: R3 d/ m! ^, Q" Svar marqueewidth=300
. ]( \' f2 \/ _0 N) _; X H8 g//高度+ Y2 b0 ] v' l/ L
var marqueeheight=25
4 j, Y" r0 O$ U, j, x V6 {//速度(1-10)) k( G- ]7 }1 ?. h' L# J
var marqueespeed=39 w4 t# M2 D( u5 _
//背景颜色0 W+ T1 p$ i) I" ]: x& h
var marqueebgcolor="#FFFFFF"6 O) N' L9 z' p* E) ]2 w6 v
//是否能暂停 (0=no. 1=yes)?
/ S) T3 M8 i. i& l; K* \ k& b2 Hvar pauseit=1
2 d- e! h( k# O; b5 J- ^6 a' b* q# W; X8 Q, b y4 D$ L1 B! T
//修改显示内容% G _% U$ ]& `; t9 x# }7 Q$ u
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' E: g# T$ }! e
( L4 V' o; \* u1 H, f: K r
! I7 l& W8 F' a$ V, h, |0 e////下面不需改变////////////
1 u$ S) z8 L6 B/ a. i* C M1 e# P$ M; x' @* T7 i w
var copyspeed=marqueespeed
6 A2 I* o7 c/ a0 ^var pausespeed=(pauseit==0)? copyspeed: 0
* P( p1 k: Q6 d7 svar iedom=document.all||document.getElementById
% V$ X! Z/ O4 bif (iedom)' Y4 _ X6 p) H: { W% l2 ]0 h
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 t/ a& {& I) Xvar actualwidth=''4 J9 r# f, m& S+ H
var cross_marquee, ns_marquee
3 A+ U$ M" M* q) S9 H1 g! g
$ S/ Q* Q! l* g- C3 D% j' Tfunction populate(){% B' B. e+ R3 C8 j$ \" B( k
if (iedom){- g+ ]3 g+ s7 z& d1 Z1 Y3 j# {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ o% |3 j) ^$ vcross_marquee.style.left=marqueewidth+8! s1 ~$ Y: K& F
cross_marquee.innerHTML=marqueecontent. G9 t; C/ [6 R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: @, ~; q) H, N* i9 {; O) v}& f) x. B3 _+ w/ Y/ j
else if (document.layers){
r( b/ ]5 L% t0 q- Q1 C4 hns_marquee=document.ns_marquee.document.ns_marquee29 k% B4 \# a: H3 m! U4 s
ns_marquee.left=marqueewidth+8
7 w( S W: L+ n* I x: ~ns_marquee.document.write(marqueecontent)
" P0 }5 g0 y& B4 s- ?& Ons_marquee.document.close()$ w& } T) i7 U! |4 X
actualwidth=ns_marquee.document.width
5 m, M; `6 o N* f7 ]- Y6 C' ?8 A7 V q}9 C$ o6 P$ P6 y8 R
lefttime=setInterval("scrollmarquee()",20)
" P' B% ^; _5 @}4 M. ~ s: G/ q
window.onload=populate8 k+ f$ |' ^4 |
" p* u% g( O- j( T) K& J
function scrollmarquee(){
6 {9 z% b9 r3 b) O& l+ L# Mif (iedom){
: l9 X) m/ [) u. ?if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 \' v. h: T% f+ g$ R" Fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! k& D# x+ s( Y9 Y3 S* G1 O* K
else
b o' C1 G% _cross_marquee.style.left=marqueewidth+8
) |$ L' x5 w2 h1 g# j3 P" v& d/ f$ X( h |* e# P$ ]
}
$ i6 K) o2 N* g3 Ielse if (document.layers){
: X8 P# a: g6 Sif (ns_marquee.left>(actualwidth*(-1)+8))7 @' L# j' N2 d+ L- I" P. ]# o
ns_marquee.left-=copyspeed* R3 Q* F: @ l2 U. U2 O/ c4 m
else, R$ G0 D- V+ @* |/ d) @
ns_marquee.left=marqueewidth+85 P4 ^) i8 Z% _/ V" T F7 O- y7 W3 d
}2 }* |# n' L8 j R
}
/ y. e- R5 P: |7 u ?: Q5 Z: E e z( e P2 l9 `. _' o
if (iedom||document.layers){; p1 G2 h8 p) X
with (document){
& }& v2 z4 n! r9 h9 V0 y, vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 }" r3 R9 W2 W1 r9 oif (iedom){
9 S7 n4 ?! N# J* X [write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, v0 Q; z) I, y: u5 k! \write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 z# F) q( d7 Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ S5 M4 U7 i* f% A3 c, n A" G$ T6 }write('</div>')3 q0 K: v. c6 [1 E
}) m# R+ T Z5 T' ~" Y: _
else if (document.layers){& K: L2 B% w3 ^! R1 l* t: Z9 x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' S) P9 l+ w9 @$ b1 @
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
i( c. K& @' R2 w# |" Q/ L Jwrite('</ilayer>')8 W& t; m; C P9 Y9 _6 s4 |
}+ @6 ?) i: Y/ f7 ~! q& h" r- d
document.write('</td></table>')& Y T! F( j1 c# U" |, m" `/ w
}1 W" u. D* R$ n) ~
}
+ Y' b2 o4 f4 b( S! Q9 r, \</script> |
|