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

|
网页之跑马灯文字特效
//修改宽度$ D2 E+ S) S0 r/ v2 y3 a2 e- f, {
var marqueewidth=300
0 I9 a' R& W' G; S0 n//高度
f, z! |4 J, O8 M I# jvar marqueeheight=25
9 ]# m' s/ }5 C" W//速度(1-10)
5 E o) U0 Y* I2 zvar marqueespeed=3
O5 G. C7 }# I$ L3 U6 w//背景颜色& r8 [. }1 l2 l4 R
var marqueebgcolor="#FFFFFF"
7 f# ^. q2 B# v1 C5 N; F) U//是否能暂停 (0=no. 1=yes)?
3 V6 u4 T% \! C1 Wvar pauseit=19 p/ Z3 u+ ]. {% u
& i& F/ s/ ^7 q- }2 J8 t
//修改显示内容& Q2 t3 T l' @8 O0 W* H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ d3 y6 U) J; V3 O3 z
! }) x6 ~9 i' j; o8 T" S6 L- w
K% b# v$ e) @! ]# d////下面不需改变////////////( a1 G& h7 W/ A% O
0 a9 L- S$ ^" K. u3 K3 Qvar copyspeed=marqueespeed
* l) T" T' `# `9 e9 Nvar pausespeed=(pauseit==0)? copyspeed: 0; |4 a) D/ X- ~2 b
var iedom=document.all||document.getElementById9 K2 \+ ^0 i, K
if (iedom): T" o% [6 ]: M' l
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 ?$ @- A4 X2 d$ U' Zvar actualwidth=''
' {) B- k" Q7 S' v7 cvar cross_marquee, ns_marquee
; D$ ~, ?& S$ d4 \ X7 y3 A$ @+ x+ G n1 o0 u9 y& I
function populate(){
4 Y! H$ k2 K- f1 Q; s6 O# U! gif (iedom){: H+ W/ T! s: o1 {" g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 \7 e. x( G$ F# Z+ G) Q
cross_marquee.style.left=marqueewidth+8
- j) F* A0 F* q6 A% R' @) {' Ycross_marquee.innerHTML=marqueecontent& G/ ]: O- I. L V2 t1 S5 Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, L$ m3 G! w* E6 Z9 O5 a: o' i
}- x0 }: I+ ?- [ ]+ i
else if (document.layers){
# \# n1 ?' G; h; ~2 Q$ Jns_marquee=document.ns_marquee.document.ns_marquee2
; ]0 m2 g4 s4 N7 r+ sns_marquee.left=marqueewidth+83 Q, Q6 F8 [2 q9 ?7 `# Q
ns_marquee.document.write(marqueecontent)
% N; p) o, O) R/ p8 Cns_marquee.document.close()
" v" z# h* [/ ^4 \actualwidth=ns_marquee.document.width3 T3 a) I) z4 `( B5 c, E
}/ T% p8 j9 u0 m; E# l
lefttime=setInterval("scrollmarquee()",20)7 c9 }. u) A- n$ |% T. n* M
}% Z) c( X; q, \
window.onload=populate1 b2 Y8 n. m# C
1 |0 D2 W; g Y4 ]function scrollmarquee(){
) g% Z9 F, R4 p0 F8 b0 @! Xif (iedom){" U+ ]- o# ?5 i6 d9 K2 `/ b; O9 s
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& z, U9 F3 ^) ]3 z! e6 ~2 |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# Z% y- g$ Z8 w+ O+ \& t: D( [) Velse
+ `9 p/ G( v: c) Qcross_marquee.style.left=marqueewidth+8
2 i+ G5 I: @/ S2 h7 \2 q: y% \% ~. S+ I5 a d8 {
}& _7 E, L! S# @4 p, Z
else if (document.layers){
8 N q& r" y6 Y9 t4 A$ Z0 C; wif (ns_marquee.left>(actualwidth*(-1)+8))- c6 P: L! c, ]- Z8 k% a6 S/ Q& @
ns_marquee.left-=copyspeed
4 _8 P) g k9 _" r# z3 felse2 y1 J z% {5 b% v! a4 k
ns_marquee.left=marqueewidth+84 r. O9 J0 ~- {/ n) \1 O
}$ l$ L2 \1 X$ c+ e
}, O0 D& c% \0 T g1 W: W
8 I5 i6 O9 ?4 t% M/ [
if (iedom||document.layers){1 `" @' G9 x+ J8 v
with (document){
' r; J0 \# o% _. w( hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 Q+ S7 a7 j( X! J
if (iedom){" f a5 s/ b% F& ?0 i, H
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 L, u* S- q! f0 s* M! k5 l: d# d+ T
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% P4 ]4 b8 T6 f& j* x. G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# U% O/ ^! P+ l8 G% Y3 b& M% f
write('</div>')9 a v& ^# _! O" j
}
7 @& c( T2 [( z+ ^0 [5 Q) telse if (document.layers){
* x. F: c$ L Awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): F9 }; A5 H5 G' ~' |8 U
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 t7 w3 }6 z; M" Z
write('</ilayer>')
9 O( K& D! {% D5 D S: e' o! A}! D5 Q! c% t+ g/ D6 |5 z! I
document.write('</td></table>')" ^/ ]( v1 D" z1 Y
}
7 Q% |2 h5 K: I5 Y2 @9 M}
, I$ A/ J; r. g1 u- q; O" T* U U0 M</script> |
|