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

|
网页之跑马灯文字特效
//修改宽度
* T! B% a8 n5 j/ vvar marqueewidth=300! m6 @$ q4 o* w# E0 D" z
//高度- K- H; y& A- X( Z) b3 U
var marqueeheight=25/ E' e; s# ^* k/ ]* L# J
//速度(1-10)9 |2 B3 k2 {" U9 @& k# \5 h
var marqueespeed=3: x. ^2 S5 U. o* g# }
//背景颜色8 n8 z' ~+ f" o& j
var marqueebgcolor="#FFFFFF"8 K: F/ y/ M* F; l9 p5 L
//是否能暂停 (0=no. 1=yes)?
. T- k1 e' i g- ^3 q0 Zvar pauseit=13 H) T5 ^/ S3 u7 j8 X z( J
/ W, }0 Z$ U, a" n2 B" Z//修改显示内容
V$ V0 I, j; g3 Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" q$ L% i( {0 j( R: X$ H. m
! i2 o* M z; T. `) {6 f. r
* J! ^* P1 n' r6 c////下面不需改变////////////
' S0 s" N$ o9 p# t w \# n
( n+ L/ B0 d) v9 s( ?( o; v/ K7 Tvar copyspeed=marqueespeed
4 G4 @; O" A) Z" V3 Q" r# @- Y/ Cvar pausespeed=(pauseit==0)? copyspeed: 0
# z$ ]7 ^2 d& y6 Vvar iedom=document.all||document.getElementById
0 S, ^ j: R/ `5 H7 p. |8 nif (iedom)
9 ?% r9 `! r0 k1 K% Z+ ~' K8 K( [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* {! w- R0 E+ [! a, A+ e( i
var actualwidth=''2 L3 z& P8 H( Y. H
var cross_marquee, ns_marquee- n) h: j! Q* l6 C
1 ~7 F) C6 j6 _' a+ xfunction populate(){
% v6 ` A3 r, Lif (iedom){3 @ ?2 a; g4 l& ]' |* k# [6 U
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
c# v, k1 ?" ] g! K) T& A d2 Icross_marquee.style.left=marqueewidth+8; \, x! I' [( k: K R$ F
cross_marquee.innerHTML=marqueecontent3 f0 `. i3 i. E
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
\5 |1 `- e! o I7 L}
* U0 s X) S$ a0 [else if (document.layers){" k; p$ O' O4 r9 [4 u6 p+ R
ns_marquee=document.ns_marquee.document.ns_marquee2
' o) }) @( d# S, C' Y. {% `ns_marquee.left=marqueewidth+8' a) D. L; Y$ b, H# W6 o' c
ns_marquee.document.write(marqueecontent)6 D# I1 I# p! P& }) U
ns_marquee.document.close(). D# R A" n* @: i/ ]
actualwidth=ns_marquee.document.width' w7 z. c" o- |6 H0 X: X' i5 T
}7 m: _3 s+ X. |) E! i8 q5 R" a
lefttime=setInterval("scrollmarquee()",20)& b4 r3 p+ H0 l& `: G. W
}( d. D# x: x2 x8 a9 f6 A! \2 E2 p
window.onload=populate
0 [3 c9 o& L# z, s$ ^1 A: n j* K- ]& ~3 b. L/ Q, X
function scrollmarquee(){$ m' `2 e1 i1 D7 M
if (iedom){4 X& f' }& A7 B) V7 |/ L/ N
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 o( A9 Q# V0 p/ B8 K( w
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" w- J- z3 P% S" P6 K
else
% Z! Y* l; S- h( g- u! zcross_marquee.style.left=marqueewidth+83 U$ c4 K# P: u7 u6 ~; k
, R s" d1 w# a/ l}
3 X& z. p, A5 R+ V s8 p( y9 h( I: Aelse if (document.layers){
0 X; y# V! C# ^7 O9 A# A( Kif (ns_marquee.left>(actualwidth*(-1)+8))
- @) T! W' [' s: b+ m% Y5 rns_marquee.left-=copyspeed
1 m: G* ~, V, oelse0 g- v5 W/ a c M" ]% v
ns_marquee.left=marqueewidth+8" @5 z! I8 u! B% I( |" V; X8 k
}
* { W8 [0 n" ^}3 [6 a4 X6 ]. o" M3 U
% G& t% ]& X: s/ g
if (iedom||document.layers){
, T# o Z8 U" [% s2 O4 c4 lwith (document){
% l" u* J2 N1 d* o6 S9 u- ~document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 x! i( _" A1 r! w" l
if (iedom){4 c1 F/ B/ ?& f: Q& o
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), k# E2 y7 F# I+ H3 Y6 f$ c' k
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 ], b/ C" w1 j/ b9 uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 Y+ u$ d S7 \# d6 {write('</div>')
: u( c; b* b5 m( }) N}0 C% ]& G" w7 \ Z: O$ n
else if (document.layers){
0 G3 B0 }: {* S) H! b+ b) pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 t* J# U0 P5 t$ ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- s; z8 L8 _# p7 L0 O& J5 ?
write('</ilayer>')
* M: Z, \5 L+ q}
, o6 w" ` B9 v9 @9 G) Q/ L; Q. pdocument.write('</td></table>')
* p. m7 _6 r) k5 r}
8 I5 h9 s0 E( w}
& l# _# r) A T" \& R5 O X1 x- x</script> |
|