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

|
网页之跑马灯文字特效
//修改宽度
* n6 U( Q' n( M; |/ ^: hvar marqueewidth=300
, K7 M! M8 ~6 c \9 d3 \, Y//高度
# w+ p0 O! M6 i- y0 cvar marqueeheight=25- F/ m- ]7 S7 l- R& c$ s9 u4 `+ F
//速度(1-10)' q ^0 J2 w( z2 v$ s
var marqueespeed=3
$ J/ i; v9 ]' x$ H5 C' L8 z2 ^//背景颜色6 J* J$ Q% \6 t3 e
var marqueebgcolor="#FFFFFF"
; i$ v, ^. `, o, P5 I9 y//是否能暂停 (0=no. 1=yes)?6 \/ Q3 P8 B% `1 T. x) D' u
var pauseit=1
4 W! t. g( X c- v" M% x8 h
& H4 C# U+ P0 ]1 F& u//修改显示内容
. C" i. U; ?# X$ U' S, \var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 R" Y7 {9 f; E4 \0 I5 q7 [4 [8 z: \
. z$ s, `( C' c' l////下面不需改变////////////4 L7 J1 W+ N& m9 R
! i- M" E4 j; q" ]
var copyspeed=marqueespeed7 o7 u( T& g) U6 j! i2 J5 K
var pausespeed=(pauseit==0)? copyspeed: 0
+ ?6 ]5 v8 G* g, r+ |& ?5 n) ?/ xvar iedom=document.all||document.getElementById% i: H5 ?* X& n6 E
if (iedom)
& |" w$ D J+ v% ?/ l/ idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: o) r! u! j+ C% {# c, yvar actualwidth=''
8 A9 n# \& y" Y) N& e% P7 B% `var cross_marquee, ns_marquee& h4 c0 P* H- ?- _+ ?% `" Z' B# P
7 ~9 i1 w3 p9 t5 T' M& p ?
function populate(){
p% C8 X3 ^1 W! j" @# { ] Yif (iedom){
% j" h5 ?% C' V" s2 l+ g+ ~2 a/ \7 \cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
A# ^$ Z5 _$ R2 g+ \2 Hcross_marquee.style.left=marqueewidth+82 O9 M1 n1 S P' ~* s
cross_marquee.innerHTML=marqueecontent ]7 s) B& e1 i8 ^' U
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# V: j) I( K! \+ M2 O* ^
}- I+ |+ e( C6 S* p) o; v
else if (document.layers){# t6 E2 g/ {. y7 T* h J+ C! a
ns_marquee=document.ns_marquee.document.ns_marquee2
& V- H( ^0 r1 Y0 h( Lns_marquee.left=marqueewidth+8
- |" \1 A- g j) W; dns_marquee.document.write(marqueecontent)
Q" }7 A! a. ~" t0 a1 pns_marquee.document.close()! P {/ d$ u; [' s* I4 B4 v
actualwidth=ns_marquee.document.width! q! O0 q) M5 r4 B
}1 k4 B$ p; B: G
lefttime=setInterval("scrollmarquee()",20)
4 L+ K t% V4 y6 {+ o}9 o, K/ X* i' m$ Q3 K
window.onload=populate
# K ^ s3 m% ]/ o7 u( R% ?9 G! ~" X! \9 k2 {
function scrollmarquee(){1 |* K3 {: p. a" Q/ h+ }* Q+ i
if (iedom){
. k5 u, c, |/ Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 |8 E- X) f g9 o& l4 [6 {
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! u' `/ S5 d% {0 Velse
5 M( @! [/ o! U: e T. W7 Kcross_marquee.style.left=marqueewidth+87 j; Z2 n% \* V; ~, o" \6 q
- e' R) B) X" O! ]; k; L}
/ \4 P3 _, R2 lelse if (document.layers){# `3 |4 V1 ?& N2 \
if (ns_marquee.left>(actualwidth*(-1)+8))
( ^: Y7 e$ n& Mns_marquee.left-=copyspeed
6 Z' k$ U: T! M+ o) Zelse
# v, h. E z2 ~. F: vns_marquee.left=marqueewidth+8
$ X; x9 e/ g r' d, |}
7 y7 H$ N5 B$ c9 T6 s0 ?}2 C6 f6 U* ^0 |% \" c) m' x/ g# Z
' j! F( R- V' F8 D' [- H6 L. Fif (iedom||document.layers){
* i! T A9 K5 {0 G2 i7 rwith (document){
/ D% x" N0 m3 p, s4 xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): p4 L- m, T( S$ v6 ~
if (iedom){
8 n' t( M6 V; N2 }# cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 w9 U- `" @* Z Awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ `" _- G# C' {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 g4 M$ C6 U$ w0 n* ^$ ~; ^
write('</div>')
) t1 Y$ d% @7 E: g7 A+ b4 _}
8 K/ Q1 x `9 T" A6 u# r1 l7 Relse if (document.layers){6 A+ Y; X/ S. p, v- r2 z5 Y, f7 d0 Q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 B N! c) `2 G3 h+ O' l- V! c3 S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# m; q; m$ N( B2 ywrite('</ilayer>')! P# R5 |* k& v( f$ T/ H8 [
}
* \% v$ |( I6 E# t& Tdocument.write('</td></table>')/ s m) R+ ^* H4 a9 Y
}
0 @8 @+ A# ?! S2 o8 d! r% ^2 Y" D0 k}& r, Z9 Y3 X+ w1 y- ~
</script> |
|