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

|
网页之跑马灯文字特效
//修改宽度5 w- o. [( a# \' `5 L! `" i$ b
var marqueewidth=300
4 e. p7 i) A8 \& A- J: {6 L: m//高度5 T% C! E" v4 t! o8 n9 x
var marqueeheight=25
' s) K8 X- C2 H$ A; ] q- Q5 `$ U//速度(1-10)" @7 a% S9 ] r
var marqueespeed=3
9 n9 D9 H, \+ h9 F//背景颜色; a. e$ J! j" _" C- [ d) T
var marqueebgcolor="#FFFFFF"" ]; i! Z- u5 V/ a" z
//是否能暂停 (0=no. 1=yes)?+ w$ ], J+ J5 ]# ~$ I& h4 q% O
var pauseit=14 n! |! k$ P$ D0 g
( o! v5 D' p# z9 O9 r
//修改显示内容3 u+ u, P0 n# {3 R: D# Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ n7 _( w5 O+ ? n; V k( v* l7 i# k
: ~7 h" n7 w7 z! b# r
& B1 m5 H1 f! j$ D% H3 m////下面不需改变////////////
8 g! @: A* ?- B: @8 q o9 R. F8 T( o4 e: n2 k/ ?
var copyspeed=marqueespeed9 Z/ |* X# k _) g9 c
var pausespeed=(pauseit==0)? copyspeed: 0& W4 G: T9 ^" Q
var iedom=document.all||document.getElementById
2 [9 b; \3 b! G, ^4 {if (iedom)4 o# C5 l) O! D- `& q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 F# d) J) f( ^' A1 D( tvar actualwidth=''
1 {4 O2 Y7 K% Q1 o) cvar cross_marquee, ns_marquee* O# z1 ]8 Z: Q2 J* y, ^2 O# z; x
+ o) l( Z1 w2 }& L: g' ^- y% X/ Z/ O
function populate(){0 \1 J) G) f9 }- E9 @3 J3 V% v2 |
if (iedom){0 C g! u+ e5 P' A7 J* ]/ Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# E+ c' \7 k# P5 D6 gcross_marquee.style.left=marqueewidth+8( I/ D: E- j N) F" K) O
cross_marquee.innerHTML=marqueecontent$ i5 d! h( B% B1 [; M# R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 V# y$ V2 A: V% B, G% V}1 \) C! ?) j1 j e' X
else if (document.layers){8 _. ~/ ?/ K3 g# R' Y: q
ns_marquee=document.ns_marquee.document.ns_marquee2
( P8 A& i4 e: |3 o- Mns_marquee.left=marqueewidth+8
' K+ z5 h! n! ~9 s9 N$ bns_marquee.document.write(marqueecontent)' n) x2 C9 u4 Q# n0 q3 D9 F/ V( G
ns_marquee.document.close()
8 f9 }8 S& A w: J! p6 d' I& Gactualwidth=ns_marquee.document.width
" F2 v2 \% @# W I. F}
6 u: Z! c: x9 P" l9 @7 P& ^lefttime=setInterval("scrollmarquee()",20)1 J+ b7 K$ i! [/ K6 s
}' _9 K o0 t' r" w# G) }; D/ {" t
window.onload=populate5 `8 J5 Z c' T2 [1 u) Y3 A
9 h5 r/ S Y1 ^" S4 q9 `function scrollmarquee(){/ K, _' U3 o' C
if (iedom){
- {9 p& A- [4 ^, Dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 P% X2 ^. T& y+ x$ t0 `
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& L9 \9 g9 [5 s% O8 s' ~
else
1 g! X' b3 S8 E$ H5 w Across_marquee.style.left=marqueewidth+8# H* i( b9 y, o0 {. U
" F! U+ ~9 ?2 d; H- H6 j$ m}
) {2 v' _3 R' Velse if (document.layers){
/ M6 v4 S& A& C+ @7 Z# Rif (ns_marquee.left>(actualwidth*(-1)+8))
5 d8 l2 W) g' {7 @4 b' h% h6 \ns_marquee.left-=copyspeed
% U( Q, z R: a. `. y3 e3 H8 selse
8 `8 ^8 @9 J1 g1 e2 @7 W5 L# a# lns_marquee.left=marqueewidth+8& O) k. C5 f% c; `% _
}' s5 H+ N% [0 D3 G3 `0 a+ o+ B
}! \. D9 d& q% V. d
5 v" D5 W* K q1 b2 t
if (iedom||document.layers){
. v- Y; P" y/ L8 fwith (document){
/ O4 g& o! ]- y5 Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% M }# B% s3 `' c( o( O0 aif (iedom){
* H/ s( J% k* j7 ^write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! R4 c- O. ~8 S, O0 Z) P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: H" ~3 U& s4 j& L3 f8 n: k0 Vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) k6 S5 x- L/ W: W3 @+ ywrite('</div>')2 o- N# X% q2 M+ ?. c" z) d
}
1 ]! f! p) q, W1 _7 ]else if (document.layers){
% @; F3 K% u) o. N3 _write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). C0 V: _6 | }- C+ z* p
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 H ] h' Q0 C
write('</ilayer>')6 j, U, F( |9 m& ?5 |1 u
}
) \! T/ }' a" xdocument.write('</td></table>')
+ [- z* e. c P, q" j5 ?}8 a. E- U& S+ [* S( Q6 m ]+ u
}
0 F/ e, W9 `* c</script> |
|