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

|
网页之跑马灯文字特效
//修改宽度# X. Z2 M- {) ~, V) a
var marqueewidth=300
4 V2 B5 w6 n5 S2 O T) h! S//高度6 k5 _2 L i' e- d
var marqueeheight=25$ P% K; l' r8 c* J
//速度(1-10)4 T* W% _4 z1 Z r
var marqueespeed=31 [: D. b* _. R0 a8 @
//背景颜色% M- ?1 H& e3 x) a; J1 A, L2 i
var marqueebgcolor="#FFFFFF"
3 k; Y' w9 o' z" K$ |2 z//是否能暂停 (0=no. 1=yes)?- [1 R, g$ k6 E9 n N. S0 a( M5 T4 }
var pauseit=1
0 V+ U4 ]' g2 Z& m I
$ L6 b8 b9 u: a/ L' e# a: f, ]9 Z//修改显示内容- N- R ]4 U5 A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 H9 ?) o$ R8 z2 M' l
/ X1 j6 a1 a2 M: D7 H; v A
8 E9 X2 Z9 b5 g8 h" u' o S8 D////下面不需改变////////////
$ a: H6 h9 C2 B8 C& [% {* t0 @/ O V: L% b9 m: _5 k
var copyspeed=marqueespeed# _6 N) m$ w. g# \( u! V3 R0 ~' w H7 d
var pausespeed=(pauseit==0)? copyspeed: 0, N/ T( R' Y z% h
var iedom=document.all||document.getElementById
) Z& o& s" |0 p) q+ U) Z* Cif (iedom)
$ I5 H. A ?' P, j- r4 f1 Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 `& `5 U# ]' t7 tvar actualwidth=''2 k7 p n% d6 } K* k. t" r
var cross_marquee, ns_marquee
, z* [) V3 Y5 L2 ]
3 m8 p' I: [7 ~, z* G! lfunction populate(){
, Q' l3 Y2 x9 k% C. J( Oif (iedom){
, v2 M. U: K0 v6 P5 w/ tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 }: U' \2 w* ?: }4 Ycross_marquee.style.left=marqueewidth+8+ H( ]% b& K: {3 W
cross_marquee.innerHTML=marqueecontent# r& E# }' x* u6 N3 \7 x/ H2 A
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' V6 u- D- q j0 a6 `$ p q}: [0 l+ a' b. A# q2 q4 h* H K' V' n! D
else if (document.layers){: `' t- ?8 g/ z: O6 B) v
ns_marquee=document.ns_marquee.document.ns_marquee2
' N, e- ~# O3 Ens_marquee.left=marqueewidth+8
7 d& v2 S4 B: W# Uns_marquee.document.write(marqueecontent)5 B5 h" ^/ b$ a
ns_marquee.document.close()$ E# S1 O; n5 _5 G& |$ I
actualwidth=ns_marquee.document.width
0 d' Y1 ^/ i' Z}
: [' ~! O9 S" i7 X! Dlefttime=setInterval("scrollmarquee()",20)
) h9 b0 O" i! i' }6 r: `6 H _0 g: G}2 g R y. x7 X$ c4 o
window.onload=populate' a: v5 g$ }- G1 `1 E6 @; Y
1 P5 A+ k: e4 [4 F- Yfunction scrollmarquee(){8 e/ x2 ?1 c0 ?
if (iedom){
$ `% b" L/ ]" v# Q: w$ A0 Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# D8 k# e! A" ^+ Q: j4 H m1 d/ K
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) s; l! h7 {: Y& {
else
3 [2 u4 H& S2 l" f0 ncross_marquee.style.left=marqueewidth+8
. H2 I4 U3 e4 [( S7 G+ I9 E
' O7 p5 g$ l' \) u: d3 a}
3 M/ ]2 ]7 |3 ?1 Aelse if (document.layers){( ^- t' u" v5 i0 J" }% A
if (ns_marquee.left>(actualwidth*(-1)+8))
4 Y% R# H% [6 Z1 kns_marquee.left-=copyspeed
+ P7 M* d! Z# o2 F- t! J; e; ielse
8 W8 M% W1 d" f3 P: }9 uns_marquee.left=marqueewidth+8
$ x5 \! T9 f: f0 e7 v: m}& n4 V& l3 g) E
}( Z- r2 l9 Y4 i5 D# G3 n# J
* _2 J3 O0 z! i. j1 g1 h3 R5 k- mif (iedom||document.layers){
D+ {$ c1 ^/ m/ U. Uwith (document){+ w% i: b" r, W; E
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 V$ C# P+ K! w3 y2 F/ |( B/ [if (iedom){
9 y: ]5 b% t! ]9 ?, c9 p1 Dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 J4 I, U- j! X! B: fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ \) Y% h3 d' C/ R. m: `$ gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 X1 ^ f* Q7 l& [write('</div>')7 r% z3 D, p$ C; }
}
) Y* T% Q# ?) F6 N0 uelse if (document.layers){2 `+ q0 |( e9 p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" f$ C& x$ V. k2 v2 T# B
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ D" {. x" }. F/ rwrite('</ilayer>'). U: {& `3 M7 O; f2 _5 t# w
}; P6 a2 q: i" r$ n/ a
document.write('</td></table>') _, u0 F+ P0 N
}2 [& f4 [$ o5 b; z3 t
}% H7 H2 i; y# Z' o
</script> |
|