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

|
网页之跑马灯文字特效
//修改宽度
3 f, ?5 e+ J4 q! E+ ~: uvar marqueewidth=300
, l U3 q3 [( o2 p# V/ h//高度
* h2 r2 @4 {! ~1 r/ {8 Y% o( g2 nvar marqueeheight=25
6 J- a; _3 l1 ]; ~//速度(1-10)
9 b1 G7 I1 B5 k6 H+ [var marqueespeed=3
# ?. D& z8 \. `' ^9 p//背景颜色
/ r9 W' M0 G( ^/ L) Z3 I. l* _var marqueebgcolor="#FFFFFF"
0 p) S r- b, ?//是否能暂停 (0=no. 1=yes)?
/ ^7 [4 D$ h3 t% V8 [' M6 Ovar pauseit=1: t5 G8 O; t2 D- |: s
* R; G9 L9 r8 g3 V
//修改显示内容
# w/ V, L7 Y1 Y' I q6 Hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% k. X: E: a$ y+ y" L* E: z5 e, e% \ v& h3 C7 V2 p: U
0 J" Q7 q! O! n- L( m% Y
////下面不需改变////////////
6 E4 E9 T# g. V; j
; f3 J3 j8 h5 k+ L* {var copyspeed=marqueespeed
% f1 s' q* n6 e+ i* Kvar pausespeed=(pauseit==0)? copyspeed: 0
8 t7 \, ?4 M, {% A: |var iedom=document.all||document.getElementById6 ]# Z2 F$ X) G6 k& G
if (iedom)& G) O0 _9 H. `. c; k M
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! n5 Z4 X$ X6 ?- m3 l! Z3 n) rvar actualwidth=''* e1 o* T4 k2 h. V+ S% k
var cross_marquee, ns_marquee% q8 v/ L2 k- V0 q
: t' Z; I% e1 W/ A: Lfunction populate(){$ g; o3 H! U! W" E/ G
if (iedom){
. L. C5 q8 e1 \: rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 c6 S7 V. k2 Ncross_marquee.style.left=marqueewidth+8
! q9 r% e- |% _+ Q2 }! Jcross_marquee.innerHTML=marqueecontent
6 E' c/ b( ] V& @! xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 i( E* w2 S3 f# d% {/ v}
% B: F5 _2 Q, U+ R' [else if (document.layers){) B+ u; z! c, X+ V' O) o o
ns_marquee=document.ns_marquee.document.ns_marquee2" U1 S# z# e @7 Y0 I Y
ns_marquee.left=marqueewidth+8% n& e6 g/ ?$ Q2 T1 S' g
ns_marquee.document.write(marqueecontent)
0 h/ [) [5 s( rns_marquee.document.close()
. J- j$ z9 x4 n; X: ?, a0 aactualwidth=ns_marquee.document.width, |" ]9 ]3 t' u4 o; j+ @+ l/ X
}
% D: E$ }! t4 F1 rlefttime=setInterval("scrollmarquee()",20)
% ?1 e1 W6 |: y l8 z1 a: f5 v% j}9 Q1 D' [( s$ m- h9 O& o M
window.onload=populate
/ y" |. {8 F' {0 e, W
' @, L/ h( y( U$ h( d6 ~function scrollmarquee(){9 K) i. s- B- x+ h* `- {' h
if (iedom){
" d3 p9 ^" J+ ~if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 x4 r: r/ p$ u9 ]& ?- U) w) V$ [, icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 n/ B; L' Y4 q# Z( F/ d, x
else6 q1 V8 D# R$ w5 Z8 X% M5 |
cross_marquee.style.left=marqueewidth+8
3 k6 A" z2 r3 {: z* @% k5 u* |& L! D& ~* _
}) }: M# Z! }9 S( F# K
else if (document.layers){
& P) `# y: O! H& u% J# nif (ns_marquee.left>(actualwidth*(-1)+8))
5 v5 S; f& T4 h0 {ns_marquee.left-=copyspeed8 e/ R2 m+ f( q; N
else
; w0 J M; n9 y) O( W7 {ns_marquee.left=marqueewidth+8% h. B& P; s4 Q! V) Q
}$ {- |- r- F2 t9 s
}
1 a1 E B4 p; r' N( ^1 k* y3 C0 e& ~6 u( {
if (iedom||document.layers){
$ m2 i3 I4 m% y$ |3 e5 K6 C- Gwith (document){
$ m2 B5 Z; @ j) M( wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ r6 _4 ~' ~0 u! f$ eif (iedom){
4 {+ X$ U: J* @- Y; K7 _$ u! @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 D3 c9 m n) n, `1 S1 a- n
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): Z4 J, W( A |0 [; h- P8 U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" o$ x8 k( r5 n' k/ {write('</div>')9 M$ e) _, u+ j& _
}- ^' @! t6 M2 \
else if (document.layers){
8 s2 B" D! w2 _ x, P: ~2 U: ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# p& @- d, f/ P( L3 l9 lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- ~3 P- s8 b, z# swrite('</ilayer>')! E! h0 n% m* I g v
}
8 e! X4 b+ I* v5 N; Hdocument.write('</td></table>')1 |" c# a, o; z- z
}
: _& f+ O- e% l3 W& k. G0 D}
6 P, |7 k5 S$ \% t+ S( \7 G</script> |
|