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

|
网页之跑马灯文字特效
//修改宽度$ C* t8 K8 _/ M( H) T
var marqueewidth=3006 g$ {7 x; V7 S
//高度) } U3 ?* ~, d7 e2 H7 i2 B
var marqueeheight=25
2 ?% K8 r. c: D' m' b" S//速度(1-10)0 g# e+ A, f S! w8 w) I2 k
var marqueespeed=3" o, N# k- A7 c/ Q
//背景颜色
8 U: `/ ?6 W. U8 H9 J5 [var marqueebgcolor="#FFFFFF"
: O: L: r9 Z b: g8 {6 f//是否能暂停 (0=no. 1=yes)?
- B$ a# t0 U$ M. c/ lvar pauseit=1
8 L* y0 B# Z* U! h7 g: U
/ q) \' V# @/ k* o: t n//修改显示内容
1 n: E. g; u/ l* b. E% m0 ]6 `; yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 Q: _. {1 n7 w M$ q! `; K# \
1 p w0 }( h' T5 }3 c5 M; c" B4 ]4 k3 Y/ i& F. M9 u2 |, F* P
////下面不需改变////////////6 m$ Q$ a" t, Z" A
# j7 I8 h6 O2 w+ {
var copyspeed=marqueespeed& W6 i: ?6 p3 r
var pausespeed=(pauseit==0)? copyspeed: 0 N o% q# W: J1 ]* i$ Y
var iedom=document.all||document.getElementById4 R0 {$ e2 F2 M- O: q5 W* ]
if (iedom)
|' f8 \3 P1 j/ A6 D6 }/ F0 `document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! v6 k4 B0 z6 X: y- t0 i
var actualwidth=''6 |% V3 \9 f6 A& i0 l" @# n& `
var cross_marquee, ns_marquee
3 q; m1 B7 S& k3 [$ q
1 r S, I7 ~- L8 k! d! K6 R; bfunction populate(){
: W( }$ G% r3 V& @& c0 X% V, y9 eif (iedom){
: z6 A7 V/ c2 U# M7 I. Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) ^: g& f; x h. dcross_marquee.style.left=marqueewidth+8
, X7 d1 W' b5 t; h9 {6 Jcross_marquee.innerHTML=marqueecontent- u6 i' Q! J+ a( I3 @9 p$ K3 U
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" k% b7 }/ H; u" e% x! ^- s8 k
}
. ?# B. S( n3 r7 j eelse if (document.layers){
* o" k0 D# ^( w/ A) Kns_marquee=document.ns_marquee.document.ns_marquee20 V+ k* G' E8 o
ns_marquee.left=marqueewidth+8/ k) i4 P5 o! p3 M4 C
ns_marquee.document.write(marqueecontent)
7 ?$ ]1 Y) @" Tns_marquee.document.close()
: o9 g; V( ^! N7 g7 \( x' q: qactualwidth=ns_marquee.document.width
8 w; O* @+ j6 A}
, B4 u: m5 C: a' V! h7 ^lefttime=setInterval("scrollmarquee()",20)
6 @+ e" ?! P5 f- v2 y6 Q6 y0 c7 l}& o. \: h) X+ u' A/ `3 u. f5 K
window.onload=populate, D, D7 t" u* M# h7 s/ O. ^$ g
( k6 i! N3 j( e
function scrollmarquee(){' `# T K5 V8 k
if (iedom){
/ ^: @, M* E3 N7 |1 Hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 m0 G% u- f3 Y5 Z( u
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 L8 @* p$ L# `2 W- J
else1 d- [: ]) W6 X$ [ P0 f0 U
cross_marquee.style.left=marqueewidth+8
+ R' U6 C; k5 X: k3 T
* j- z4 _4 d9 ]# C: K& `}
( K1 P; N% I' W/ b- Z! Gelse if (document.layers){/ k6 x' w) p! S5 [; c( M( g7 |) j& V
if (ns_marquee.left>(actualwidth*(-1)+8))
, r7 f: c+ f9 o9 Y( |9 a$ Ons_marquee.left-=copyspeed& @& @; I) @1 ~' x0 g3 U
else% x' c, N% g- k# x5 a8 n
ns_marquee.left=marqueewidth+8
, k6 S; p* H% T8 R! S5 o) j1 ?}
/ G, \. q- z3 g5 I% q1 Q. I}2 F$ a* [7 h) {) [- |0 z: s/ Z9 z
- e: h+ O6 |5 J7 B7 f
if (iedom||document.layers){% o @* F0 s1 i$ ~# R
with (document){
. O1 K9 G. q) Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 D' f% ^. i0 h$ R+ }: |' ~$ W
if (iedom){
1 D1 y2 X1 F' h/ iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 ^. ~, \5 q+ i7 Y. i, u2 }* h9 nwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 [1 q" Q4 G8 G# t& C3 U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* {2 U$ G# i i3 z lwrite('</div>')9 ]' `) A% `* P
}4 S) E( n+ Z7 ]1 S+ U
else if (document.layers){( j. y# b8 o# e; P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 K4 i% n9 p h+ s
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), u7 H1 ]0 ]& h' ~; V/ |
write('</ilayer>')
3 Z5 q' k B5 ~ E}! n$ q9 e# q& m! A/ U O# K# I
document.write('</td></table>')
9 b/ C* o9 k# z}
) K5 C" c! p7 e3 H P- V0 t0 m}: E7 s% x+ A5 P6 O- d( `4 `
</script> |
|