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

|
网页之跑马灯文字特效
//修改宽度
) D1 `/ E% {+ uvar marqueewidth=3008 v9 C# |, C" X
//高度1 e" ~4 n/ S, Y/ ~, m: Y5 f: G
var marqueeheight=25* H1 Q. t- B. f0 D: p
//速度(1-10)4 W, ]" W0 l' l, Y! ~' B
var marqueespeed=3
+ U# G6 x" B: E( S* L//背景颜色
9 m/ n5 G; ?" C- F2 P5 q* Zvar marqueebgcolor="#FFFFFF"
/ O, `1 p9 f) s' m5 H) |+ N1 Y//是否能暂停 (0=no. 1=yes)?( `1 Y- H. v' ]0 c1 k$ M' O
var pauseit=1
6 ~0 M" Q2 v# Y+ W' X. e6 C# ~8 j9 m
//修改显示内容
0 ?$ k- [- B/ o% [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 A, Q" M+ K, _8 x
: g! E0 K) \- L5 }4 e; ~
5 q; I/ s9 V$ m4 }/ o
////下面不需改变////////////, t( F( Q, Q5 u! f! t4 v3 c
, J% g a- S( w' J5 G: |var copyspeed=marqueespeed; T7 [3 Z, X; S% z4 n
var pausespeed=(pauseit==0)? copyspeed: 04 X L+ k9 I5 u, X
var iedom=document.all||document.getElementById
. ~& w0 y( a( ~8 t" Aif (iedom)
8 Z1 Z+ m8 x; r+ @3 W9 ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( t6 ]; \ L( K4 ^& rvar actualwidth=''
* q2 p; W- }% Gvar cross_marquee, ns_marquee
. g' ]" e, ^% n! J8 l; |7 d. ^7 Q1 R, V8 [3 x! c
function populate(){% j" A' P9 @5 y$ K3 E
if (iedom){
E/ w$ C4 ] d1 Z9 Scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- n0 l" J) s6 T0 B8 q1 T _
cross_marquee.style.left=marqueewidth+8
- [9 |& W- K. C; f( d2 x* ]cross_marquee.innerHTML=marqueecontent
* `8 Q, m1 i& r3 w! Ractualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 d8 Z9 z. U2 c}1 e [, d% t0 X6 ~# z1 F( y
else if (document.layers){+ K* {9 N U4 x& W2 r
ns_marquee=document.ns_marquee.document.ns_marquee2; _% r7 G |4 c9 U3 Q
ns_marquee.left=marqueewidth+8
: V# I! t+ T9 Z& G( Hns_marquee.document.write(marqueecontent)
) L j9 K9 z; E$ o& c* Xns_marquee.document.close()& r; t4 Z; [4 s* U5 P8 A
actualwidth=ns_marquee.document.width2 N# d4 R- {9 D& z A/ Z
}) g* ]) {/ i6 r
lefttime=setInterval("scrollmarquee()",20)8 C) v7 a1 Z d( n/ G6 i% V) M' ]
}
- j- K1 M) }4 u+ W/ g1 V6 Z$ ywindow.onload=populate! |7 E8 \8 e5 ^6 W3 R
3 R5 M( J8 ^, I, Z( T& J5 E
function scrollmarquee(){2 F, s7 O @' y( f
if (iedom){* _$ S7 {+ i3 @' [9 n
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 D' |2 d/ q0 R8 J6 C
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 y% M/ U; Y, [ c7 _
else
# M! l4 g) \+ v! N1 A5 @cross_marquee.style.left=marqueewidth+8, m3 b2 |5 v4 u" X, \) |1 z
# n: e6 A/ F- V! e, I5 t1 A
}; R$ l/ B* ~- ~1 S/ F
else if (document.layers){/ S6 n: W. W, S5 o# z( \
if (ns_marquee.left>(actualwidth*(-1)+8))7 @2 C( z/ Z. j: g2 {" z2 L: Q3 ?
ns_marquee.left-=copyspeed+ l6 g* l- ^7 d2 |3 `
else
, I7 Z6 R* F% S( hns_marquee.left=marqueewidth+8
1 w# B0 |9 ~9 o/ E1 ^0 g* ?0 X}9 v4 L' w, @/ U; H
}# w$ ]( O2 y7 Z! \
1 Z" u+ g0 t+ X3 Xif (iedom||document.layers){
/ h: L& |7 ]7 g( B2 ~0 q% ]with (document){2 m: j% l6 z5 a& ^* L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- k! a o3 `7 O5 w4 l$ Mif (iedom){
: U/ W& |7 o" G7 n- ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): A9 [0 h/ y) U3 u8 G3 T
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 Y! p8 i# q& s3 Z' Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 U$ y5 j7 \4 m. k: `& T- Mwrite('</div>')
+ |- E. P1 I2 Y U6 F! v7 t! F$ T5 A( `! E. w}
2 M$ D8 z) F* |. X4 g2 X7 |. Uelse if (document.layers){
" m& m) t0 C# }9 G$ C6 y( w! X* dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& R( K# A+ y- A* Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 {, T v& o# z! jwrite('</ilayer>')
& l3 b. z; N% ]2 s8 W& G, e}8 T" h8 _5 m% H% Q6 K
document.write('</td></table>')
, z K6 ~! T5 Q* b) L. b3 K6 h}
, {) F! J7 z" h}
; ^ x- j) F" f</script> |
|