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

|
网页之跑马灯文字特效
//修改宽度
' g/ _. c8 w- z/ Q* s5 e y4 cvar marqueewidth=300
. Y+ s8 W: \0 O//高度. F" Z: h; x9 p4 ^. z
var marqueeheight=25
, I- |( K+ ]2 V) n//速度(1-10)7 a! {' f8 v, T5 s* @; _. r- O
var marqueespeed=33 }; _. X. d8 f2 B( V2 U
//背景颜色# |5 p" h9 L7 U" Y" X/ r5 ?1 X# s
var marqueebgcolor="#FFFFFF"0 M6 R- d! b, J. i* N
//是否能暂停 (0=no. 1=yes)?! q/ q% e( q+ C
var pauseit=1
, O- x6 z8 }/ v- y
: I( P6 X: C) K0 H) q//修改显示内容
* F4 ^! Q' J# J" evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 K' i( O0 W* w! x. w% h
# d1 i4 v- s1 l7 Q
' y, Y! Y! q J& R
////下面不需改变////////////
& P1 |4 c* p1 a4 G2 E( n5 G, F3 r$ c4 y& |
var copyspeed=marqueespeed- Q$ _" k8 }8 _& {! A3 I
var pausespeed=(pauseit==0)? copyspeed: 0" g- S6 n6 J: l, v
var iedom=document.all||document.getElementById
. ^; q% L' c" ?4 ^ h" k* Qif (iedom)
q3 O. S4 q. {8 }& w' F- Hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. u9 `/ T- h& P+ A& svar actualwidth=''
+ E5 l5 N6 @2 y" T/ V& ^var cross_marquee, ns_marquee# ^0 ~$ Z( C3 m+ b" a& H+ e
) E* l) [$ R' E3 I4 O2 Q& G- sfunction populate(){
' E* X5 m, X$ ^% c: h1 f! [if (iedom){: Q, \: }# H* o( c+ [5 e! m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# o" E0 f7 A' |cross_marquee.style.left=marqueewidth+8
$ }9 g$ y: O. @- u1 a' j8 gcross_marquee.innerHTML=marqueecontent- q* U% P3 e1 ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 S% J6 K. }" ^; \, O3 l' n}
0 p' k2 C) t, @3 Ielse if (document.layers){. U! A# a% i9 s4 C# A1 ]
ns_marquee=document.ns_marquee.document.ns_marquee2
. q! T: |+ Y. T. }ns_marquee.left=marqueewidth+8
$ `6 e: i8 D: ]% [- vns_marquee.document.write(marqueecontent)$ n3 T* R5 v/ f, C
ns_marquee.document.close()
8 _# f- L$ O. i, R5 G( Qactualwidth=ns_marquee.document.width
- y, D. Y: C! z/ l}
8 x: n" y& O+ n) _) [( {/ M( plefttime=setInterval("scrollmarquee()",20)
. f( _! y2 s* `/ y3 R}) J5 I3 N6 e) U! o1 x8 G' W: @
window.onload=populate
: Q: d4 p& P, ~! g; c2 C
) l+ T0 x: t9 d- x0 \function scrollmarquee(){3 i& X5 s0 _; ^1 r2 H
if (iedom){7 h( ~6 I. T# w) S. u/ U; |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: c4 n- j& w+ x5 d4 ?6 B& C1 Bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, {% B% {% P, }9 M: P6 N
else
7 G+ g( O9 b8 C- Z8 [# K. rcross_marquee.style.left=marqueewidth+8
8 T' i5 i% F( F. `# i! g7 R
0 L8 \) v2 l* y* v0 l u}
- W. R- l q4 J2 @else if (document.layers){
7 ~! w( m' r. t/ l g: S! D: Q3 nif (ns_marquee.left>(actualwidth*(-1)+8))
' x- P7 z! k& K+ o- `ns_marquee.left-=copyspeed
0 Z. |: b" S4 F. R" v0 M3 y, |else) m) S6 i5 ~5 l! ?! B0 @4 |
ns_marquee.left=marqueewidth+8" [9 X* X F9 @! V) |7 h" @
}
9 u5 A4 `7 G. M" Y$ l+ _}: ?" s. R8 Q) F& i( o, r8 r! P: g
6 L3 c0 ^$ a1 M+ j' {9 G! ]if (iedom||document.layers){
1 D6 b2 d$ v) {5 |with (document){
3 s" d% G0 M4 \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 Y" q: w0 W# j& J8 g0 o
if (iedom){+ F; @% p/ @- L7 w. o8 Q6 U1 R
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); `, q% U$ m# g, f( \" R1 u
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ i5 P3 z0 Q7 c* a$ |' ?% gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" C& T5 _( Z) Hwrite('</div>')% o5 W7 Y" s* h: q- W
} E4 g0 y i$ a3 U# G& C0 ?+ ?7 j
else if (document.layers){, B1 O2 k& [; u' w1 j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) P7 J+ w/ S5 `- o* N* |, Y: ?
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 R: W, Q. q8 w8 u# |
write('</ilayer>')
* p3 `) C0 @" R8 D1 t% j5 G3 y}/ R1 D3 S% X8 a3 h" R1 N3 q- l
document.write('</td></table>'), h, q4 A2 }9 l1 M h/ w
}
) `, P/ E( P, H- |0 G* u: \4 \}
4 D* V7 l, _1 @</script> |
|