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

|
网页之跑马灯文字特效
//修改宽度
2 `& f% m, F( `4 L" k7 nvar marqueewidth=300; k: S6 C3 {' B0 A3 b {7 C% T) b
//高度( Q8 `7 U/ f3 B6 t6 `% _3 @: T! J
var marqueeheight=25
0 Y2 r! A2 g! O Q! q y. f+ D//速度(1-10)
6 r' \7 T4 T* _var marqueespeed=3
& q# a' n' o2 u7 c//背景颜色
! ^* X6 E3 P- P' B/ F! [( Cvar marqueebgcolor="#FFFFFF"8 V1 U2 U1 [# ]& }9 T
//是否能暂停 (0=no. 1=yes)?
6 x$ R' o( x9 O: O% Evar pauseit=1. p* V/ c4 h: g; h" {: R
5 z# e3 l: Z& W; G& X1 k
//修改显示内容% [/ a2 B- b k+ l6 S t8 ^) C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 R9 O' T; w) p9 U% W- J5 m
& ?' x* X) b# e( }* S5 B# k! `
' S3 T: A! e; l2 ^* A; C" j( f+ [0 w////下面不需改变////////////2 e7 M8 N( W! ]- I/ i$ v+ J# I# U" J
6 O9 h* x1 |2 g# K
var copyspeed=marqueespeed* L$ I6 H8 H4 E, i
var pausespeed=(pauseit==0)? copyspeed: 0
% y# @8 _8 ]8 vvar iedom=document.all||document.getElementById
! f6 y; r4 C7 Zif (iedom)
L7 F! Z- I! e9 {, e: Fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 J! O( H& @) P% Q+ Z: w( |
var actualwidth=''' r- k% p8 ~ G' f! {# M" e8 I" y
var cross_marquee, ns_marquee
0 w$ S0 y) b) f0 M& k( k0 v' O, B/ L: d: ^# `. ?6 q, y! G
function populate(){
$ @- p4 U! K$ W, X" L& }0 N4 Fif (iedom){ [& m8 B+ [1 m2 q3 \' A
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 E. g+ t8 R( J. F1 I' q: i0 tcross_marquee.style.left=marqueewidth+8" ?! ~, Q0 H9 u6 ~: ]
cross_marquee.innerHTML=marqueecontent7 i0 p* A& Q+ E3 Z) M& h8 U8 Z2 M) T
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% I! U/ a# u/ k; y
}8 W4 {+ A: S3 e4 X, i( O. I- w
else if (document.layers){% O) J/ h; G+ n- y6 ^
ns_marquee=document.ns_marquee.document.ns_marquee28 |1 a3 a$ a0 V
ns_marquee.left=marqueewidth+85 i% [0 k% `( [. s- N. @4 b$ A9 \6 \
ns_marquee.document.write(marqueecontent)
7 R G$ I+ T4 Q. T) I, V6 [' Z4 ?ns_marquee.document.close(): @" S: S/ o/ r4 e7 A0 C) H4 v
actualwidth=ns_marquee.document.width
. h/ Z4 }. t: I9 \/ K}. ?( ?0 F* Q9 _, Z# [# c6 O
lefttime=setInterval("scrollmarquee()",20)
, i- `0 G K; F5 S}; n7 T& w$ I1 h2 h# U" u
window.onload=populate& K! a. g- _3 q+ v
3 \1 ^* p7 n$ h/ n5 F. ~0 ]+ ]
function scrollmarquee(){& [& J% P, K3 b$ d
if (iedom){& K' t5 G$ n. U p
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) n2 r" ?: Z# n" J3 j6 |) H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! m! O& a" Z9 @! \& |5 s1 A* m: n& E
else! l \% J1 l2 t! ]7 |/ P: K
cross_marquee.style.left=marqueewidth+8
6 E- F! N* r7 R) x N0 W
. \4 b0 U5 ^0 ^% K}( s8 v# a9 B1 w7 _7 E
else if (document.layers){
T4 h7 y6 T, G. m. kif (ns_marquee.left>(actualwidth*(-1)+8))
( ]* h* w3 d* J' qns_marquee.left-=copyspeed9 d' i. D! a& H" A3 j
else
8 W4 `- j9 q2 L9 ? H% hns_marquee.left=marqueewidth+8
: H$ I. U4 B6 X. I}
7 i; a( T+ p! w# y/ M}" D. f% j" V/ D8 d
9 ]- w0 g, _% E" k0 G, _' D
if (iedom||document.layers){5 H! ] x( R; @; l& W2 a
with (document){
4 @# j) {. S% j& \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) v8 K; y' G: n2 l
if (iedom){ o+ Z" w& J0 _3 c' ^0 Y9 m9 H
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 t0 N/ z8 k+ G8 h1 p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& R5 d# Z- N$ l v6 gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" {, T- H/ S% Z
write('</div>')
# c& l$ g# e. v; L2 F}
' o" y( A, z$ c5 t3 f# Q8 oelse if (document.layers){5 R0 Y# k3 }- ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 q' G1 l6 Z1 r4 |: T
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# Q( b, e4 V% Q( a qwrite('</ilayer>')
, @, y" R. X1 y: z1 E! ~}$ y+ E$ I* U2 D' i3 a! B
document.write('</td></table>')
4 G* C) ]# I9 P}
% d" |8 X6 {8 C! i: m3 P% E}
c5 B4 j0 m6 C. O</script> |
|