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

|
网页之跑马灯文字特效
//修改宽度3 q; K1 T( w. B1 J
var marqueewidth=300
+ W) m1 [! W5 Q3 V' w6 r! }* c//高度2 Z9 H- X# n9 p* K
var marqueeheight=25
2 ^/ @, W A/ E2 y( R3 P3 @//速度(1-10)
. p: Q# \* \5 F* M3 D2 |% Ovar marqueespeed=3
6 z F- U7 A5 A( p! D" J, U//背景颜色7 k ]! n6 m0 J/ ` L+ J
var marqueebgcolor="#FFFFFF"
7 Y" Y5 O) ^: C, _* M! {7 K//是否能暂停 (0=no. 1=yes)?# F/ Q% z# K3 e/ U
var pauseit=16 _( ]8 E9 q3 K2 A* J* }4 E- [
+ j. D2 u6 W% c* Y& U3 K; t: H
//修改显示内容7 c" g" Z" x% P: Y8 v7 B F
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', n% h! i' A; h) i1 P
8 L' t$ R/ {2 g, p6 E p: e" h* O3 t* Z" G9 z
////下面不需改变////////////5 b! B% }4 n9 y" U0 \4 Q
0 y$ z* j- V: e; C9 fvar copyspeed=marqueespeed
3 C. Z: }, F3 r9 D6 o4 o: Lvar pausespeed=(pauseit==0)? copyspeed: 0 \$ }% R6 N |' [
var iedom=document.all||document.getElementById
# x+ k5 q8 O( x @6 T, rif (iedom)1 q$ E$ d( h/ \) l4 o9 J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 @! d* I, @% L- X$ k* t% \
var actualwidth=''
0 V4 I" E0 D6 b% E2 |3 V, Rvar cross_marquee, ns_marquee
$ O0 }+ m. Y9 L0 r1 u" g E9 _# P' W7 s
function populate(){
q9 X9 y0 G) w M& H, |6 _if (iedom){( Y; O6 Q) }6 k$ A7 s- q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 `; G1 m4 z/ v+ l& \; o" l: ^5 ?cross_marquee.style.left=marqueewidth+8
g* D: p9 Q/ U4 c$ T& }8 ~8 bcross_marquee.innerHTML=marqueecontent* g6 q) l9 ]' U" b) U
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 _8 F% [& k R4 o: R7 N+ O1 T" y7 D}9 D# S) U( L% r2 ?
else if (document.layers){
; s9 ]# Y9 S' g1 w* T% Zns_marquee=document.ns_marquee.document.ns_marquee2% x+ k" O: Q: ?& r$ i. l- d
ns_marquee.left=marqueewidth+8
9 V/ c8 e% I/ u' [4 V" W0 Xns_marquee.document.write(marqueecontent)
# B& Z" N3 L* ?: p& d/ e) Ans_marquee.document.close()7 }2 n: t8 V* k/ x
actualwidth=ns_marquee.document.width
$ L" ~" h% L/ b: O+ m7 i+ Q: p6 a}
" h. t# `# s& g9 ]. ~lefttime=setInterval("scrollmarquee()",20)
- s9 R$ \1 C4 _5 \ |, T3 M* m}- Y, z S) U6 [& p4 E% F3 X
window.onload=populate
1 r7 o, Z; K! ~4 J/ S! u1 U2 F1 K' Y3 W, A0 F
function scrollmarquee(){1 ~5 e6 s! I u0 ?& j; l% \6 m
if (iedom){, B5 b/ r% s* j: E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: R5 X1 i! { O2 k- O* X% z5 r& Mcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 L- ^7 s1 P% h$ [3 _4 ?2 I& @else
* H" t' Y8 @; N1 c( i: Ycross_marquee.style.left=marqueewidth+8
6 k( c/ z7 C2 v% F, K& |3 W
; W( n- i5 Q! |% H4 Z h}$ a. j% w- f8 Y" d
else if (document.layers){# s! N4 z( I3 C. j i" K
if (ns_marquee.left>(actualwidth*(-1)+8))! |( I7 C5 M. M
ns_marquee.left-=copyspeed |* J+ |6 ^0 f4 V8 ]
else
1 V1 B( J; s! V8 w& Bns_marquee.left=marqueewidth+8
3 \5 Q! S' m/ i, `+ b}: s; ?1 F3 }- G! L
}
- ^6 E$ y1 O2 \% v/ h5 n. K$ D j- b& p5 {' b; ^& z8 P
if (iedom||document.layers){
( g' n# w& l' F0 `2 r/ ^with (document){% M- W& i7 n" U d+ l( ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* A: N( V7 F2 b
if (iedom){
7 r, _! {) b% V# E+ d0 O, k Q4 Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* y2 H) I2 E5 b6 d3 a/ Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 h% o8 ] k {- T# L2 U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 ~" f/ _) s7 E6 }7 A8 }5 x% k
write('</div>')& ^* o; V# d: Q( F& i1 B8 ]! m/ ]% a
}5 V! J3 X5 g# B4 k$ l) z
else if (document.layers){4 s- D* F: ^" {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ n6 ^ ~( H8 ^% I# F
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. X) M# O8 ?1 u twrite('</ilayer>')
8 ?& I( `& N( V h1 x* z5 o) ^. h$ q}
+ \& r- g- A$ w2 X1 d, Udocument.write('</td></table>')
- m) x8 C! s" ^* _}
' B' i% F$ c7 A5 X) V}% b" v: \/ |( k: O" W
</script> |
|