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

|
网页之跑马灯文字特效
//修改宽度- g) t H' T& c
var marqueewidth=300
2 H2 g: c$ r- V7 ^//高度
. q1 A6 v* z/ D0 R$ a9 Q: k4 ]var marqueeheight=25, j `1 o4 Q$ A7 m @% G% u, v
//速度(1-10)
1 x: }) I* N K F9 \5 o- a5 b2 Wvar marqueespeed=3
, ]5 ], n. p& n1 q( e, o( d//背景颜色
3 J, O' _3 y+ ~, Avar marqueebgcolor="#FFFFFF"
; D. W' S: C' R' d4 s//是否能暂停 (0=no. 1=yes)?" V# J9 m t8 m. T
var pauseit=11 W3 }. U# C: [0 G q# `- h
) ?5 N; m" S G" F+ X
//修改显示内容
I- k, s3 i& N6 z1 v) gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 [8 C0 v3 w3 g# b3 _/ q3 ~+ q# Q9 K) |& R
( f [+ C/ c5 a" {, L* q! \////下面不需改变////////////( x0 J+ `! w5 s
: n6 Y, A2 D' xvar copyspeed=marqueespeed6 a. b5 X) g/ b1 T
var pausespeed=(pauseit==0)? copyspeed: 05 p3 R: ~7 l# X/ w) v
var iedom=document.all||document.getElementById
( v5 a" [) w) U( Vif (iedom)
" {: p% L6 A1 T. s. ?- fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& ~0 ^( I6 C2 R0 k8 ivar actualwidth=''
: C _, t( k; h4 e. S' e2 l4 t) Svar cross_marquee, ns_marquee
0 D0 A# [- i* B T
: M3 v6 h: A+ h% tfunction populate(){! J1 j- ~2 n. z# }" R
if (iedom){
6 L2 g' t$ B) K2 L8 G( ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( v8 W9 d2 X7 A+ Q- i7 G+ h. K
cross_marquee.style.left=marqueewidth+8
/ U- b" f. z4 d! s7 N) [; p0 jcross_marquee.innerHTML=marqueecontent! P9 j: B! e- b$ X* x" V
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 U0 f9 c' W9 X* @, a
}
- d9 I! A/ q/ R" M- T0 k uelse if (document.layers){' m7 y+ _# I/ S5 A
ns_marquee=document.ns_marquee.document.ns_marquee2
; L" C7 X2 z$ }5 tns_marquee.left=marqueewidth+84 E5 @) s: f# Z# O& l1 k# t6 C& _
ns_marquee.document.write(marqueecontent)
! s- c. D4 k7 yns_marquee.document.close()' |% Q5 ~% R \3 d& u$ x1 @& \
actualwidth=ns_marquee.document.width
' ]3 D0 d$ \. C7 \. K( w0 c}
7 U/ z+ M2 a+ J8 u. K' i, E: [lefttime=setInterval("scrollmarquee()",20)) e+ p2 j7 ^) V
}/ K- ~, f# y7 q4 k5 R6 p
window.onload=populate6 U7 n1 M: M9 ^+ p% V7 X! x5 u
( {# a' c: I5 F
function scrollmarquee(){
7 y" u. _$ L3 cif (iedom){9 c- t1 J% {8 j8 u
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ G% @7 z8 I* G Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ }) l5 C5 k! j0 uelse1 t4 }3 s% f# a! |( R& ~+ W* q
cross_marquee.style.left=marqueewidth+81 k% b0 A5 i) h0 Y- A, ?
1 Z4 C: v7 K+ J1 {}
2 Q2 k8 P) F+ u9 ~ ?. Belse if (document.layers){
& Y7 q' L) U, e( g2 K% x7 n9 ^0 ^if (ns_marquee.left>(actualwidth*(-1)+8))
+ [4 E, J. V$ _( Nns_marquee.left-=copyspeed. E8 r* @) p/ ~, o
else
! {/ w9 G5 Z5 r' kns_marquee.left=marqueewidth+8
d, R. b' O) H7 `2 \}/ O* G1 q, l5 L X2 @8 P: C
}
) `6 e( Z; I# C' q$ J8 P, M8 R- ^. j B
if (iedom||document.layers){
$ W8 ~ a% ~; z" c; J: U: \1 H ]- v/ Jwith (document){
" S8 }7 ?* x7 ]' ?: ^) f8 pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ x8 \4 J: x7 W# uif (iedom){" a( L i8 A* v7 M& w3 @
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( k' F- ]9 H& P$ A: _: i
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% \# m5 f2 ^+ \& _( ~4 F; a4 C' vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) Y" ~& l1 h+ |; S* |6 ewrite('</div>')
% w' d7 @- {# T" P; B4 R5 K}
) S0 y) I1 g, P/ J/ L- ?/ Telse if (document.layers){
# O% A. p2 {# |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 p2 w. m& O% I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 W" Q5 c; g, U7 M8 [6 H* m
write('</ilayer>'); f5 \9 R* i/ p# F
}: ]5 a- j0 E5 ~
document.write('</td></table>')
" f1 G+ b" v' j6 E* e}5 B# e! ?1 G- K% s- ]8 I- E! D
}$ C/ l) x4 u4 B1 `% S
</script> |
|