返回列表 发帖

网页之跑马灯文字特效

//修改宽度
- \1 R% |% h5 a& avar marqueewidth=300
: R( E$ m2 e3 o//高度! [1 o$ t, Q/ n* F: b/ z, C
var marqueeheight=25
0 g/ B5 [1 p0 T8 r8 B" d! ?, ]! b//速度(1-10)
' e$ f/ {+ t$ |& P& ^var marqueespeed=3
9 e* C; I% J0 z) ]5 S, x/ u//背景颜色  y1 Y% \5 ^  r0 d: t" D/ `& Z, @% S
var marqueebgcolor="#FFFFFF"
4 o* `' [5 a( p3 F1 N8 U//是否能暂停 (0=no. 1=yes)?
7 h, N2 z4 ?/ }* Cvar pauseit=14 g, p. W1 o' O: ?$ K. V
* F# W0 n( a% h0 R) W% l
//修改显示内容
! M- R3 `' t. I2 |- Y" {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% Q1 G- O+ Q4 s6 z
$ z/ ^* a+ B9 Q2 C( u* b. h. F1 \: P, S4 x7 C. ~8 {
////下面不需改变////////////
) ]5 d# I. F! E0 b4 e7 I
- {" y2 e; \" d/ Y  S* c" M) Xvar copyspeed=marqueespeed6 q. S2 y# j- ~( {7 j( [; J: r
var pausespeed=(pauseit==0)? copyspeed: 0
+ Y) b, _7 e- Pvar iedom=document.all||document.getElementById
$ c0 ^- M2 a. J. @! oif (iedom); j) F! v6 I. R3 \+ Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# L. L. {; h1 @2 l4 W
var actualwidth=''. `% E3 x0 X/ e6 K, ^
var cross_marquee, ns_marquee
0 J; x+ e4 z* s6 H7 y2 j9 W: E  \9 k, U
function populate(){" X) w. R. l; e
if (iedom){
3 Z/ p6 p1 t/ u( n& ~& l! Kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( \" Z% |  C- B0 B4 ~; [6 ^cross_marquee.style.left=marqueewidth+8
7 p/ ]8 g' s$ h) T8 x- @3 d& icross_marquee.innerHTML=marqueecontent
( S8 Q7 ?& U6 a3 C& |* }( N# e2 `6 ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" {  n; z# G9 j, J# k
}" Y" V$ q. S3 o
else if (document.layers){
* M2 d: L% z! Q& Sns_marquee=document.ns_marquee.document.ns_marquee24 }7 }3 g0 W' P
ns_marquee.left=marqueewidth+8
/ w! X: M9 u1 {ns_marquee.document.write(marqueecontent)
$ L, f5 [* i& R% a: ~$ ?# {ns_marquee.document.close()
7 W( d$ K3 b3 A$ b3 X4 c3 Gactualwidth=ns_marquee.document.width
' p9 o; a6 g1 w+ W( T2 ?+ x}# R" z" t7 y7 g/ j# v7 U
lefttime=setInterval("scrollmarquee()",20)
2 }: h1 ]) Z! P, b; I  C}3 ^6 f3 N0 I' {+ W( W+ c
window.onload=populate+ F' [+ [0 Z! x( O9 q& w! Z5 _
$ K3 B% V1 }! p1 x/ i
function scrollmarquee(){$ a$ E9 B& q2 ?* d
if (iedom){
: |3 M3 c. Q( p& |- H# Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); k9 i1 B8 M+ l0 [0 O, M
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 b% X7 ^3 N) B1 ^) W
else( ]" A' A0 f2 h# K; j
cross_marquee.style.left=marqueewidth+89 `& `8 X, R$ j9 F& K% w& L
0 Q/ I8 Q/ u5 T+ b1 i, j8 h
}* m& h0 q# I+ P# L1 j) [) V$ f0 ]9 I
else if (document.layers){
/ t9 `3 @% y6 J5 e5 N! u( rif (ns_marquee.left>(actualwidth*(-1)+8))
) L5 E; P- L# M  {4 n# E; V2 Q/ |ns_marquee.left-=copyspeed
8 T' o, {) D7 Telse
, e2 V$ r" e5 ~% Ens_marquee.left=marqueewidth+8( F: Y! ~& H# ]6 s" q6 `
}3 k/ |& Y6 s0 n+ V' ?# h
}" A5 i' ^; e2 A+ u

4 i2 |! \2 ~3 t4 t( a+ y  Yif (iedom||document.layers){9 i' h# G) C" }" r1 K
with (document){
1 w( i: p' J* O+ kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 F, z: Q0 T/ I" U3 ~2 U) F  N0 p
if (iedom){
, E2 |& r4 q* p% ^9 K( H7 `! V/ Qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) M% S: }1 A/ P$ r& Q. t7 twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' ~3 r+ b$ x6 x  O/ U, T4 @write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' w* o: T  D- `0 r% v, ?3 nwrite('</div>')- X0 q6 e  d$ z5 W# b, R: L  |
}% X2 X5 J! y0 A
else if (document.layers){
7 d* W! z9 Y. Kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 d8 P. t* t, y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 v3 U% ^7 h' L* Z! d6 a
write('</ilayer>')
/ c" i+ H" C! T7 H4 c+ X; B}
4 ^" T$ ]: j6 E4 c2 ~2 X% ?2 n" odocument.write('</td></table>')7 W) z. u2 U7 u: e
}
4 c0 V- S# s) [}
/ Y# I- B$ D# ?5 d4 `</script>

返回列表
【捌玖网络】已经运行: