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

|
网页之跑马灯文字特效
//修改宽度
1 }) a6 S+ @" p0 g5 \% fvar marqueewidth=300! R+ h( u' R; N
//高度" I. U- y6 e. ]. Z9 s
var marqueeheight=25
/ O2 W4 f& T1 M* ~$ G( O2 ~! }//速度(1-10)1 O# J* f$ ^. }( C
var marqueespeed=3
7 L0 i; \4 ~, [ H3 R8 _* R//背景颜色3 I! H4 H# T" w, i( Y8 r
var marqueebgcolor="#FFFFFF"% e/ Q/ k2 {4 F5 \* f
//是否能暂停 (0=no. 1=yes)?4 d, l- Q( ?2 B' A7 l
var pauseit=1
" ]& w$ s6 ]+ u% b! |; {+ k/ U. H5 P1 I
//修改显示内容
3 K' v% h3 v* g* R5 d( {1 B# ~4 tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# z! }. p4 q4 X. _+ o* ?% w5 i! M: M" \2 B& w
9 Z {5 Y5 P, M, o
////下面不需改变////////////
, U( d8 ?" Z6 I+ S) U/ s' g. N6 ^ w2 e9 N1 r# E% o
var copyspeed=marqueespeed
8 ^2 g8 T- b3 ~7 ?' \var pausespeed=(pauseit==0)? copyspeed: 0% D+ G; X ?/ F5 b$ c7 ?- l
var iedom=document.all||document.getElementById1 H4 r( U2 Y; K+ \
if (iedom)
* R. L/ d7 g- `' f9 H# odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" X# ]9 W% X* M6 \- t' C1 Hvar actualwidth=''
" x9 C/ R) F3 L& y3 |var cross_marquee, ns_marquee/ w3 I, M+ S" H0 V9 \) o! |
p5 ^* S2 O1 l
function populate(){) x! U- h7 g, h
if (iedom){- J8 _$ B# ~" ?+ v" D8 j. S
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- V1 ~7 D0 R |& @/ I; X
cross_marquee.style.left=marqueewidth+8
! R1 i! E# J$ m" M" mcross_marquee.innerHTML=marqueecontent. L/ E- A4 G6 k2 d
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% w7 F) ]' i: _2 p) ~ X" R0 D7 h# N}9 Q4 v7 T$ H) H1 A$ C
else if (document.layers){& ~3 [7 V" m. }6 o( E* k& l' {
ns_marquee=document.ns_marquee.document.ns_marquee29 X, @! M1 B; Y4 d! v
ns_marquee.left=marqueewidth+8; ]4 k4 p* `9 @, L- x8 r$ }
ns_marquee.document.write(marqueecontent)
( c! C+ B/ `$ ^: N# Bns_marquee.document.close(). f) @7 V- z9 [8 I1 i- ?$ V
actualwidth=ns_marquee.document.width2 H/ M0 F, k3 c- |1 `+ V4 p9 {4 X
}
) g9 ?9 |1 {" I0 _/ L& U! |lefttime=setInterval("scrollmarquee()",20)
6 k9 K. T' _7 ?& I. ]9 F/ |9 f}5 s8 O$ n; L# B# v3 P# b; N: c
window.onload=populate3 t1 J5 Q1 R/ Q9 |+ V% D
: x; W$ z. \# nfunction scrollmarquee(){
, m* p* P" q6 P9 }- e# u. E( sif (iedom){
2 W3 e- m3 D- I2 o0 sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 \ ]$ i, l& @0 Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* e2 n8 H7 N5 r& H: f% n
else
5 h/ J0 b% o. s; n4 @cross_marquee.style.left=marqueewidth+8' {7 Y. y- X/ g/ r
3 L$ ~7 a3 w1 A6 H}
4 Y3 B0 p# O. G6 y7 F- belse if (document.layers){
+ W/ U8 g4 f8 g/ a' ]( ?4 Zif (ns_marquee.left>(actualwidth*(-1)+8))/ j. e# ]6 F' w' S* E$ n
ns_marquee.left-=copyspeed' F& v4 f! K6 \8 S: U
else2 m2 H7 k0 `5 z- o4 H* P/ o, x
ns_marquee.left=marqueewidth+8
- V/ ]4 m3 ` C3 N% j}
/ E2 e0 }: F3 R* S}% G$ z7 w( |5 _( w" g
5 I& n: V5 v: A: q6 A6 [
if (iedom||document.layers){
# W( W6 ~- Q! x$ U7 k7 y' vwith (document){
9 O4 v/ }3 s6 Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; w9 U7 Z& k# G7 f6 Iif (iedom){+ x- O1 D! G4 y7 q7 W& C
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% L& `1 y3 ^% y2 ?
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( i: v! W3 y& l! D' {5 k. xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), ?) g5 T9 Z4 |; f5 C# H+ `
write('</div>')1 _+ ]7 }: a6 R
}+ P4 k% l* G4 V( d6 W- I2 v: ~
else if (document.layers){
! ?' W0 R7 u% ^. r# Bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 t0 i- @1 `3 e2 {7 hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) _0 R, b1 {7 Wwrite('</ilayer>')' V: _5 C* J' d4 |* X! |
}1 ]/ j e& F% h/ E5 R' @- I: ~# y
document.write('</td></table>')
) H5 p, M) }+ }}
- S: p. }7 b9 e- y# k" a, ?7 c}
" p% f0 D& x$ n( V# Y</script> |
|