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

|
网页之跑马灯文字特效
//修改宽度
! [# Q4 c% ]* [ [4 T5 Uvar marqueewidth=300* Q& b) G/ i2 c4 @9 Q
//高度" Y) z2 q; s0 u4 Y
var marqueeheight=25' w$ D; e: q; }* O2 z
//速度(1-10)
: o. q( d6 _0 d2 k( s- Vvar marqueespeed=3
" F2 H( d- i* ^6 J- [; q//背景颜色5 Q6 F# S8 X6 Z e0 X# H" ?' u( L
var marqueebgcolor="#FFFFFF"' J2 y( m; u0 r: d7 s
//是否能暂停 (0=no. 1=yes)?& G0 `- j+ D/ D. j# D c
var pauseit=1
( A7 W' n* o* z& k
1 ^, X8 ~3 ^/ P! X2 q//修改显示内容3 r6 n% p- p8 }: v
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 g. o" ^9 b6 r1 n' x( S
' X, `, I+ N6 G& c7 A5 I8 B7 S
P" \7 I, N- J% a$ w x////下面不需改变////////////
: s& w% r$ g: s, k8 g5 z9 ?, T+ r% S/ K( n9 c7 i# F9 \4 A
var copyspeed=marqueespeed8 X9 B6 m, P: n
var pausespeed=(pauseit==0)? copyspeed: 0
, K7 \* q; y( t) L( [var iedom=document.all||document.getElementById1 T$ f% j2 Y4 l' D7 H
if (iedom)
% {; `- Q( ]( A0 ]1 p* ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ L2 p" N( l0 }4 B+ t. ]% R) gvar actualwidth='' e* U8 |+ I0 V4 X8 h* }
var cross_marquee, ns_marquee
, z! Q% i. e) V3 a, }5 M! l% J- q
* l" p. O; R2 I+ s* T& dfunction populate(){
8 Z9 `2 K: c- r* k# {# \5 I8 Mif (iedom){
. n1 d8 v* x$ scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, S1 f- q: k; Y! `
cross_marquee.style.left=marqueewidth+8) {/ U/ f4 r) H# N$ J8 b
cross_marquee.innerHTML=marqueecontent
$ {7 k0 j5 o- X( Pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ [* e# z! f; ~8 W7 b- `7 d}! Y8 o: ^& {; `; i3 m0 m- h
else if (document.layers){0 F( Q2 p2 k0 A1 ^4 b( @ V
ns_marquee=document.ns_marquee.document.ns_marquee28 o! ~: Y, i% G4 `) p- i
ns_marquee.left=marqueewidth+85 g: d8 r1 b, P* Y) s) A
ns_marquee.document.write(marqueecontent): o* o1 @9 u$ @" l% J6 s, ?, u
ns_marquee.document.close()
5 y1 Z* g( [* X* t! Jactualwidth=ns_marquee.document.width2 i. s6 ~4 E! V
}1 V' V, r4 q- W( C9 P/ y
lefttime=setInterval("scrollmarquee()",20)! H+ i: ?7 J8 G) ?1 ?" M
}
$ A& W. Z/ z1 owindow.onload=populate
5 E% L- |: A4 G. ], T$ [$ Z" R5 a) ?7 d2 @3 g; ]) u
function scrollmarquee(){
9 j2 I: e3 J" [" Y* _7 Mif (iedom){
7 x5 r+ F+ ]/ u- B8 ~7 uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 {/ N- n1 Q! y8 c0 g6 R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 w9 e u+ q# e& \% gelse# R! q$ k ~. L! s& w
cross_marquee.style.left=marqueewidth+80 W Y7 U' n. y: }5 S+ O' g3 a, H
: c! C. S8 C' `" V9 W
}
# U/ A. Z( Z* J/ Velse if (document.layers){
5 [8 Z2 w6 w. @0 o& {; x7 N# Nif (ns_marquee.left>(actualwidth*(-1)+8))/ v6 Y5 y: h0 @
ns_marquee.left-=copyspeed
8 v/ z1 J7 j) ~6 {4 o Pelse
* q) |5 q8 E8 T( A6 _, _2 Sns_marquee.left=marqueewidth+8
2 s" L l8 k8 H* D2 M}
: a% M h7 l Y( a5 ]$ h9 Z" `}
1 s! Y2 y3 }% Y$ D' W$ I: e, s
$ h$ [' i- R/ n! h( jif (iedom||document.layers){9 ?* L) v; B3 Y9 D2 c$ B
with (document){# c; ^$ L( e1 p: e+ V u
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, [: y. i7 [+ l! `2 Mif (iedom){- k) ~1 @" L% w; T$ {. I2 s
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 J" `. {% p) |$ W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% k/ G% w# f' o
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). W* C6 j$ x1 r: u! n
write('</div>')
' h: l; H% |! u}
) f" z8 t2 }$ y- }! Relse if (document.layers){
9 L4 V4 \; d: ^: owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ T- g% d7 q- N( D' Q1 T# |write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% U. w3 I$ Z2 I. e& Ywrite('</ilayer>')
- Y- Y- A% C$ O}6 g, c9 L: {9 \/ C. F
document.write('</td></table>')
; Z5 U, A6 ~# D. y}
& ?' g$ ]! L$ M" L; k: i4 n}% I! }8 d$ t9 `; V" G
</script> |
|