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

|
网页之跑马灯文字特效
//修改宽度& s, }' W+ z) n- c% L0 R+ }0 l% D
var marqueewidth=300' w7 W: M( p) a8 A$ u
//高度
$ o! `6 W2 u# jvar marqueeheight=25, _' S& G% M1 U7 O) r
//速度(1-10)
- M; B& D5 n3 h- T# D+ s8 ]var marqueespeed=35 W! B, U Q( ^9 l8 S' [ V) x
//背景颜色
$ W1 N9 b- u! E X# [$ ivar marqueebgcolor="#FFFFFF"
7 @ q* H: H$ g+ V r3 L4 f$ s: v//是否能暂停 (0=no. 1=yes)?4 C/ q2 G+ a1 O/ _
var pauseit=1
" a; s4 c7 p0 P8 [
+ z' Z W5 F" f; z# N' _//修改显示内容4 r8 j4 ~4 F6 q9 c9 [ `
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- y' n$ U7 O1 m& d$ \) O9 M8 g3 R: L0 a1 b/ S
% d( ?% V/ Y8 |8 u" Y) J4 v////下面不需改变////////////1 x5 t/ B- a! d5 W+ H5 ~
8 i( b" s3 |3 z. D$ X8 qvar copyspeed=marqueespeed
9 l4 @2 t9 Z- i) M0 |+ jvar pausespeed=(pauseit==0)? copyspeed: 04 x9 W; K( h3 Z3 ?
var iedom=document.all||document.getElementById. `" S0 e3 X3 n) D$ U+ m) p0 ?8 I
if (iedom)
3 T$ X. Z+ s" l, b! R' g/ ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 U- `4 ]% ? B- k
var actualwidth=''
) v7 n0 ~ P; p6 D; h7 Evar cross_marquee, ns_marquee
* t9 C0 N/ v* H; m1 K, c! K5 j* P
function populate(){
+ E4 M B3 }' S9 c1 Uif (iedom){ ^/ v1 @$ ^. x8 m! I1 I, ?6 R
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 C8 [- x% Z0 O6 qcross_marquee.style.left=marqueewidth+8
! ~3 [1 y0 a& f" A5 Rcross_marquee.innerHTML=marqueecontent8 ^+ s- i8 m1 x9 h1 h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; X2 E. U/ S4 M/ ?$ K# B}( R5 s; ~2 l& h- f. w1 k! P
else if (document.layers){! \- T1 u# P0 `$ D: f' v% X: F+ W
ns_marquee=document.ns_marquee.document.ns_marquee2
- [+ P6 [* u; yns_marquee.left=marqueewidth+8: L4 @( U. a3 X! E( S5 L
ns_marquee.document.write(marqueecontent)
+ E- I" a. P/ M7 y/ F$ ?ns_marquee.document.close()
- L% @7 U+ w6 S( e$ bactualwidth=ns_marquee.document.width" p" V: R; ^1 V; l" P6 i
}( b+ b$ r i- P0 T# ?! E( e
lefttime=setInterval("scrollmarquee()",20)2 ]; D8 @8 _' r& O- n
}2 E5 L/ ~. h+ Z* u* G+ }
window.onload=populate' z- m' I5 j! }) i' M, ~$ u
" h2 D: q- }+ z. T( Xfunction scrollmarquee(){
8 Z( w: a9 a; _if (iedom){
0 L% b5 q6 y o- z4 A9 l) Iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* h4 y! j: u3 Y; j1 Vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 B1 C* }! D1 f: w/ A6 welse
0 [9 j& _1 P( i7 z- G7 Z4 P% F; R' k" a4 {cross_marquee.style.left=marqueewidth+8
/ ~1 r' `+ w8 {: [8 Y2 p b- \$ a) L' A2 @7 r( r+ [
}
9 w6 l: _! G/ X# i' [4 Q& [: I& belse if (document.layers){
0 d" Y" }! L7 `! c# s0 r# Y& ^* v Yif (ns_marquee.left>(actualwidth*(-1)+8))2 s! R/ p" {, x6 x
ns_marquee.left-=copyspeed
( J; W" b' r$ Z3 ?! G; pelse: Z8 i9 k5 R+ V! o7 e: F% d
ns_marquee.left=marqueewidth+8
1 l, m/ [1 \9 c! i+ z}
+ N& Q6 ?6 n- U5 B}! X8 t6 ]- j5 x0 ^
1 G; I& C! U- I* D* m/ z! ^if (iedom||document.layers){, ~1 p: D4 @6 r; r) |
with (document){: |3 L8 P$ p( O( ?0 ?% Q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 h& y6 u$ S" J- a* s. _& Dif (iedom){/ W! K9 c7 n: E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ V' H; k g" o; n0 rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 v5 _/ q/ {5 A" ]& b' c" r
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# c' C; E- ?5 [( g
write('</div>')( t' C2 t U0 U( f" M
}2 T O' u) X5 \8 q' A7 P
else if (document.layers){
6 @! u# L) C+ C/ _7 s4 V1 j+ u$ R3 Xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 s' W% a- M7 @% ?7 | L4 b
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, F6 c# _' [+ y8 f% Jwrite('</ilayer>')
( w% R' C. b; x1 A; M# B, x}0 q2 k3 L1 B p" u
document.write('</td></table>')
; G/ l& Q, k% E" f! P1 H}: U8 b& P- m: o) j5 I/ y4 E
}
8 m# O6 c$ M p</script> |
|