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

|
网页之跑马灯文字特效
//修改宽度
6 U" Z4 l% G, | K9 E' T2 Vvar marqueewidth=300
8 I' \" V' Z0 G//高度
. k9 o( p S8 D0 c( }8 S pvar marqueeheight=25; T# C, j2 P ?
//速度(1-10)
+ p0 E; w; W! f& v7 l R Avar marqueespeed=3
8 p3 h% r( u; q/ p0 P5 x3 A//背景颜色
) Y% Y* u+ z& g6 g) O& A" S$ O1 Cvar marqueebgcolor="#FFFFFF"7 I0 j- i# G! t* T' T# p O
//是否能暂停 (0=no. 1=yes)?
1 D3 |; o3 E9 s4 Avar pauseit=1% I7 `- p+ T# }& S2 [
$ S- O7 y3 K4 y! m! x* V
//修改显示内容
" c' `6 N# R, zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ l6 t3 I+ ]' }5 I$ {$ L; B2 \7 _% L5 u8 p% ?, v# C; ]
3 ~+ x+ k2 O( Z. l9 M' N( [# l2 a
////下面不需改变////////////
3 A$ o$ D6 n: P. j& a
4 D( o5 k0 D$ Q8 l; I/ ~! y3 Rvar copyspeed=marqueespeed
/ l5 a5 l& p% o2 t+ u1 r/ U: ^var pausespeed=(pauseit==0)? copyspeed: 07 \) {2 l% z1 g `* e5 P
var iedom=document.all||document.getElementById
" L5 ]) B9 n" e( t8 [9 \+ Dif (iedom)
0 g. ?: Z- h6 K& n& n- udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 T9 d$ A; o9 p7 b
var actualwidth='' ^8 v. R, {2 p& l. h# T% [
var cross_marquee, ns_marquee
$ H! r: ?- `6 ?7 m2 i8 t( u9 u0 G$ z7 x4 D( f5 [1 q7 f
function populate(){
, f6 Z5 m, i( `- cif (iedom){
& y) _$ b1 t5 rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ N! i( T, o1 \# o& z
cross_marquee.style.left=marqueewidth+8% h1 Z8 Q/ x; v6 o1 i
cross_marquee.innerHTML=marqueecontent
/ B0 s0 n7 y7 {9 Cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% i% a3 |( x4 Q% j# i3 u}
9 y1 z1 J- P0 N, t- `: Telse if (document.layers){: Y9 V( L) u1 n3 `- g
ns_marquee=document.ns_marquee.document.ns_marquee2
( a! L8 s0 K4 @! C. G1 Tns_marquee.left=marqueewidth+8* ^8 v C* s( k! W; r- ~
ns_marquee.document.write(marqueecontent)
* v v d( `3 Ans_marquee.document.close()% q# c7 P( F7 I: H
actualwidth=ns_marquee.document.width
; K7 N9 u, g) p- l. g6 T: C$ _}3 ?! q4 S* F' i7 S2 @4 D& k7 K7 h
lefttime=setInterval("scrollmarquee()",20)& w0 |/ e+ @1 Z a# W
}
. ?2 g$ r5 w, C, S% J% Swindow.onload=populate
; z% z9 C+ r% {. x' [+ Q# v
( X O5 Q1 C- S, \function scrollmarquee(){
! s4 R4 I7 ^: Y9 K) h/ Y! ]if (iedom){' c* d5 i3 x8 C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 p' `) H' A' R. M8 V; w+ R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ E$ V2 d% x" c' ?% Y' I# A
else
4 t3 B9 G: f, p% n: P+ _5 Bcross_marquee.style.left=marqueewidth+8
. N, u) c. c% q* }9 Q% L6 M+ ?, Z* _8 n/ O, J4 k" e" X
}
: u2 I4 I' o9 @2 v( z$ Melse if (document.layers){6 p M3 p; R/ b5 ~
if (ns_marquee.left>(actualwidth*(-1)+8))
. Y' ~/ L+ J5 d/ |ns_marquee.left-=copyspeed1 M. P0 K7 V7 N. D/ f9 m( H
else( w7 B/ f+ U, \
ns_marquee.left=marqueewidth+8
9 V% _8 ~7 J$ H D7 {' m# C! F7 h U}! A; i8 U* r, N
}
& C2 S8 W- w# D' s7 a) |
W3 q o- I- u( G! U+ [if (iedom||document.layers){
+ Y9 N0 i2 e1 pwith (document){
3 f* U( |/ ?9 z# A* X3 |+ X( Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; O7 c- _! f# P* pif (iedom){$ N0 n1 J3 h* k5 B
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ Q/ E) ~7 s b5 c- l) C1 W( w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ q. T, ~' a/ w5 {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- p. b5 X2 P' c" d% _' J
write('</div>'), B* l$ R" p, Q- T3 S
}/ H" J ^( C* V& D( H
else if (document.layers){
; f" E! d5 j2 Owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 B" d6 i+ H! N# xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 R: s. }. D! z2 u5 Z, {2 ]* x2 Gwrite('</ilayer>'), V8 V4 k- M7 e, p1 ^$ V2 P- ]
}
: }5 ?) \5 ?6 }- _2 ^0 L* ]9 T6 Mdocument.write('</td></table>')
' N5 j. F# O" G) p1 J}
( a9 A! L/ N3 E0 n b q. X$ A1 O4 a}* _0 y8 w3 k5 v
</script> |
|