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

|
网页之跑马灯文字特效
//修改宽度1 P& w! O+ v! S4 ^2 @# C
var marqueewidth=300) b! X0 u) z1 r$ f
//高度
' G4 f$ t* G3 T* t# u3 j) L+ Avar marqueeheight=25
1 N# p/ E8 g& g4 P! n$ d" z//速度(1-10)* @# j2 R, T8 t" E" k, E
var marqueespeed=33 J' D* y( [: D* b, w8 k
//背景颜色
B; k( J) n( o7 i. a( g: e4 }var marqueebgcolor="#FFFFFF"
: P/ q0 e. v! ~8 c, ~2 T1 _" ~//是否能暂停 (0=no. 1=yes)?0 t e- b# u6 d# K' N4 N( P
var pauseit=1- w: r) G" A7 P; Z4 y. C; c
' e+ |- q- R# d# f
//修改显示内容. M( [/ ^% H9 h: J" x Y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ p6 S5 s, O2 Z; J+ X/ I4 G2 E8 J1 D# M. @9 b4 Q |" R
" R; f" d9 Y/ M0 ~4 Y2 X N( l( n////下面不需改变////////////
, ?) m8 i w) D) ~1 B4 P" e$ t% d: q! }2 ~: t7 f
var copyspeed=marqueespeed
0 m5 N5 U, z2 G7 ~var pausespeed=(pauseit==0)? copyspeed: 0& M* |' d6 h* c! @) h+ |
var iedom=document.all||document.getElementById: o% X4 N7 ?9 W0 \1 G' O/ L) L
if (iedom)6 i; Q# a& w1 F$ Y( x# V
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( j! F r+ l! p2 ?' f+ N6 S) Jvar actualwidth=''" f( I c8 B2 W
var cross_marquee, ns_marquee: F# `3 v6 J8 t' x; e0 ~
7 z5 \2 y0 L$ u; c4 c
function populate(){
( q; v. P5 [* M7 w5 { N0 \if (iedom){
f( ~, K8 [( x, H- S( E) }5 qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 q5 S1 m( T6 c0 h1 ]
cross_marquee.style.left=marqueewidth+8, }' U8 r0 o2 H% m
cross_marquee.innerHTML=marqueecontent
: h* Q0 b6 q0 H. |/ _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ v/ u* v# D% d! u}
' i6 J7 L. X5 s/ w+ ?" r$ belse if (document.layers){
2 z) L% W( e! \' l& i8 |6 ins_marquee=document.ns_marquee.document.ns_marquee2
2 M2 r P$ A @. ons_marquee.left=marqueewidth+87 |0 O7 p& S, o, n- c4 F# i
ns_marquee.document.write(marqueecontent)* V9 i5 r: j, j
ns_marquee.document.close()6 W' G) R4 w6 F! c
actualwidth=ns_marquee.document.width& S: a, B- y, c( K4 V; M- \# h) O* A; X
}' V# d' F3 W* |6 ^2 t
lefttime=setInterval("scrollmarquee()",20), E! p" X% d, v- U% c
}
2 U( N( K$ ^" o9 u9 w1 Uwindow.onload=populate
0 s) q- _! _7 L ~8 k' B r) p/ W" p1 P3 |4 `. }0 J" l, ]; B" _
function scrollmarquee(){
5 u- W4 m: H. P1 O$ z: d5 tif (iedom){
. X7 _/ s" e% @, B1 T8 rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ Z/ t) t9 O3 [( G5 F+ B
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ `1 T, V& `8 I% E$ k3 \else
9 N4 A. _0 ^" v) Qcross_marquee.style.left=marqueewidth+8& c+ f& r& l3 E5 ~; Q3 u
8 U! H9 }% u* c3 i( n+ T}
" [9 F8 K5 F2 z9 o1 m0 @. melse if (document.layers){
, Q1 P8 j* n7 u& d* Y# V% ?if (ns_marquee.left>(actualwidth*(-1)+8))5 X2 b. L3 ^6 g8 _3 _9 l
ns_marquee.left-=copyspeed7 @9 x: _5 S1 U
else: Z. i& E1 C4 D2 o7 Z
ns_marquee.left=marqueewidth+86 H1 c3 a. h6 y2 D
}
9 {# _. y9 S7 d}
+ |# M' M- t# c) `* I3 Q
7 `$ a$ C8 C3 J% @' N/ cif (iedom||document.layers){
+ s+ M0 I6 s- M0 f( i" s A7 _with (document){
# r% f W. K4 Z* a2 I4 Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 ]: f/ P/ u5 j. {. E' g z+ e2 K% B3 x# tif (iedom){; l5 t9 E0 y$ K; ~* a$ v2 f2 I
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! z# s; }1 X- x- N4 v* hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 Q2 I$ u. g: @3 y4 r/ bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 `) E2 M2 r- Q7 x5 i8 i, d' O! j3 g' pwrite('</div>')1 W6 h+ Z9 a6 N, |* ^* z9 f; A
}, _" V# b9 G/ w& o9 i
else if (document.layers){
3 N( J4 |0 \- {- C0 E2 Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* L l' ^3 W/ G0 c: a- P2 u+ N
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ g" a4 f. Y. y+ B; [$ @write('</ilayer>')2 \. t5 X2 c3 Q$ Z/ U& `/ y! d4 v
}8 ^# Y* n D0 N( ~& M
document.write('</td></table>')
$ |: S/ y' J' i, A}+ I( L5 Z& n+ V+ z8 g/ T2 n6 b5 o* X
}) u8 p# ^% \ X! p
</script> |
|