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

|
网页之跑马灯文字特效
//修改宽度
, w6 j {" _, K" ]9 A& }3 {( F$ [var marqueewidth=3004 `% L! |* `4 M+ |
//高度
4 G4 j0 J$ w& T" b* Mvar marqueeheight=25
# h: b+ S4 Y0 A2 z//速度(1-10)
# G! Y2 l/ M% [& qvar marqueespeed=32 @. \1 b9 c) l+ V' }8 e R
//背景颜色6 W) Z. G3 x- t
var marqueebgcolor="#FFFFFF"4 F1 H6 q! q+ r" J6 D7 T
//是否能暂停 (0=no. 1=yes)?7 i6 i' p$ N0 P' v! G! X/ L
var pauseit=1
- K4 L M x' ?! o
* ~/ W/ Z% i3 Q B4 A+ U//修改显示内容. J* p' e( U, P j2 z- ?, j! T
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( T2 M" ]4 \+ g% @' h+ h
* F6 H3 O/ ~4 h! g: @/ J
8 c0 ]. D" d) K////下面不需改变////////////
+ i6 }5 Z7 m. P" T' x: C ~) Q% w1 U4 d- G
var copyspeed=marqueespeed/ F" ~* U0 \; R4 u8 Z
var pausespeed=(pauseit==0)? copyspeed: 0
: D( [; b( D0 {8 X3 D; M9 J3 q- ~var iedom=document.all||document.getElementById% g8 H6 a2 t8 @
if (iedom)' f$ p4 D; C1 H- }
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ q; p2 V! N2 G) i$ ~var actualwidth=''/ H0 l4 b6 V% `% o2 i
var cross_marquee, ns_marquee
8 v' W/ o0 W0 Q9 g' A$ U
: `/ x5 N+ w" H' u5 ffunction populate(){9 U' U! e3 A: e0 o( x: P
if (iedom){
( b( u' S( x( fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 b7 C W0 j0 o! `9 U" B; y
cross_marquee.style.left=marqueewidth+8* a, A! U) Y/ k4 f0 N
cross_marquee.innerHTML=marqueecontent
- t* w7 U! C# ^9 J; I' s- S% O6 Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 J. w6 J; s# e" H! p% }# V
}: B) Z, g4 d! U5 j
else if (document.layers){+ ]4 |* I7 k5 b& @
ns_marquee=document.ns_marquee.document.ns_marquee2
9 u" X, ^0 G6 R6 S6 fns_marquee.left=marqueewidth+8
% ?: P( ~5 H! d. L& m4 B$ lns_marquee.document.write(marqueecontent)7 ^) Z- Y0 e* e8 |) o
ns_marquee.document.close()
1 l, v( a! f) ^! n+ o* I( _actualwidth=ns_marquee.document.width
" g+ T% x! N2 F} j, K1 o+ q: U; u
lefttime=setInterval("scrollmarquee()",20)
9 f7 u( X8 | K}
6 v S. r! b [& M$ ]window.onload=populate
3 m7 ?' J( {& a9 ^- d6 p0 V0 E. P9 _2 H9 w2 P
function scrollmarquee(){- C! [5 u' p3 o9 B+ `4 A! R
if (iedom){
0 |- _( I' `% ^$ U+ y" ^2 sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 c' j+ U" y, p5 a0 f6 p& y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; P# y: Z" T) A+ O" P3 k2 T/ Yelse% O2 T7 r& `' N( r+ k
cross_marquee.style.left=marqueewidth+8
0 G7 c0 y* O2 C' q( c+ U# E* G9 n0 j/ V ^. A! |
}
1 @2 R5 j/ N- @. \( `" T% F& `else if (document.layers){
+ ]1 l' T$ H/ S, s- U8 ~if (ns_marquee.left>(actualwidth*(-1)+8))9 h( i3 q8 b1 p
ns_marquee.left-=copyspeed: f4 s' N" C9 y8 U
else
* l6 E; b' P2 P) t1 D$ ens_marquee.left=marqueewidth+85 h l* Y4 b( n# k
}
" w0 T: L- j3 p1 N5 C# z. [}
7 H& _$ T# p3 x, [5 j
1 l* C+ @7 ~4 o3 l7 q) Jif (iedom||document.layers){; Z/ s+ f, y+ l4 c! @+ n, i
with (document){
; K1 t% n# U2 U1 h7 V/ L' `1 Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! x' p4 I9 P4 J e' Y
if (iedom){
) f2 ^" v2 w3 A9 K& wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 R9 M% c9 E/ j3 |write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
{. o9 X: S% n8 n3 m& kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
{: r c4 A* ?7 _# n% F" @, j* N4 Iwrite('</div>')
; r$ `0 I- Q8 B1 T5 |4 A {}
7 b4 }% P- p6 N# J( _0 |/ t8 `7 Gelse if (document.layers){
4 {/ m3 A1 j5 }$ Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') Q) \5 x( N4 V4 |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% M8 @% b0 J* k+ [ i- C
write('</ilayer>')
/ u( ? y2 [: b/ s& l' X}* b |$ P3 F. h- v% [
document.write('</td></table>')
/ s6 X( b' Z5 p4 B+ {: k; z}
. w: \. z$ b& `1 I& j! i}# A% f" d! Z* m
</script> |
|