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

|
网页之跑马灯文字特效
//修改宽度
/ W7 t( V+ l0 \' ovar marqueewidth=300
+ C" F! n' v' ~//高度
; W4 U( n, `5 d3 t) A. ^& o* evar marqueeheight=25
+ }! U; x8 e9 u$ m" n2 e$ D# {" p0 B//速度(1-10)
6 G+ w; H$ G4 r: t0 rvar marqueespeed=3- |, i( {8 ?& `" M: ~/ p
//背景颜色: r& v% v4 Z# Y# x+ c3 K
var marqueebgcolor="#FFFFFF"3 f; J8 U( X/ x5 `4 u1 Z
//是否能暂停 (0=no. 1=yes)?- _3 M4 G0 h% `* P5 v0 U* P2 Y
var pauseit=1( z- k1 X) q! t- D G' U+ l
+ n8 B4 f/ z# F% V- O3 A! s//修改显示内容, }- u2 K& G$ p- [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) [" {7 O! Q9 O8 O
7 P9 K8 V. R9 H; v' o0 m) \2 c8 M: R
////下面不需改变////////////! T7 o- P N( n
' H1 O+ l- G% p3 k/ n# [* O$ lvar copyspeed=marqueespeed1 Z- G3 |0 b$ ~% n; F; f$ k t
var pausespeed=(pauseit==0)? copyspeed: 0
9 ?9 Z! G+ {- N3 L) Gvar iedom=document.all||document.getElementById
$ s9 X, X$ q6 I( X5 M- C. eif (iedom)
1 d. a+ [& J* ]) k0 w; F2 z4 A; Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' J _* J% h& | M/ X# Rvar actualwidth=''+ W1 T; U; g F4 h
var cross_marquee, ns_marquee
/ v8 O' n* j- W9 A" X$ \' ^9 {% l F4 l: K+ p. T* J+ ^/ t
function populate(){1 k5 H& s/ g v' q) U
if (iedom){
0 Q4 ^ t# T/ ~! ` ?9 Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 g3 r; Y, q' Q" ~" [. v8 r1 a: ccross_marquee.style.left=marqueewidth+89 O+ q% y% r& _! \! d" T
cross_marquee.innerHTML=marqueecontent
% q( Y8 c4 B( o* ]" M6 [9 Cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 f3 R3 m( S! E- o- B# L1 z' n
}
( H8 Q0 n( c8 p2 r8 M1 a T4 E% lelse if (document.layers){: T, o4 j4 m9 U2 ^$ I3 o; Y
ns_marquee=document.ns_marquee.document.ns_marquee2
9 D9 g& ^6 S1 d5 G) g+ t( fns_marquee.left=marqueewidth+8: C/ Z' A6 x' |' ~
ns_marquee.document.write(marqueecontent)
2 E+ S5 q+ }! q" h1 i8 P2 Wns_marquee.document.close()* A# `8 ?' z8 z* R* b
actualwidth=ns_marquee.document.width
% D7 j# Z4 G: U" j}
3 n0 ~' R8 f. j8 n, \' T, alefttime=setInterval("scrollmarquee()",20)
8 a( X8 V, P# A8 O* p- E, t! o: B}
' `+ @; A5 I- G0 ]+ n) lwindow.onload=populate, l9 U' |; e! {6 }" K( Z1 h: f
+ ^. b1 H$ g; d, ~- g$ gfunction scrollmarquee(){
E; j% G+ ?' t# [, n" ]if (iedom){1 g1 d. e: k& Z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 a/ x) d9 @2 B7 t' V9 ]. [; ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" _8 X# e1 J9 M/ q0 o( t; L
else
7 U) k! k7 ^3 f6 Across_marquee.style.left=marqueewidth+8
4 C/ u8 p+ b H; K6 J5 d8 O+ x8 ], O( h9 Y1 }: E7 i/ i
}- M2 V0 b2 {8 i7 u t8 i
else if (document.layers){$ ]4 y- t, c5 v' P. h9 N
if (ns_marquee.left>(actualwidth*(-1)+8))
7 i0 s4 o R5 ^; K2 j) f$ ons_marquee.left-=copyspeed
" l; y0 r3 B+ t" gelse# T+ |/ \; e$ u$ O, R8 {
ns_marquee.left=marqueewidth+8
$ U/ Z: R/ I4 v}2 N( n* b) B5 T0 K* k2 D
}0 k* P T- ]( f3 u) H- b
0 D6 ^' ]! l- ^6 r& Y2 P
if (iedom||document.layers){5 }* m+ ~ o% ?7 e) Q9 A
with (document){2 L& O; p/ \6 z8 V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- U; [3 x9 X/ v0 `# R& [* {if (iedom){
' u' ]0 w; B) |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 U" S9 R: L/ _
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 [) _, N5 k0 `6 N
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). l9 |- \1 T0 m3 w$ l# _& W
write('</div>')
2 O% Z8 A& [, q& o( B, c K5 x}9 V( B7 F8 D6 y4 w; ~% {
else if (document.layers){0 i+ }$ W3 `$ n4 K. k9 K
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 Z" A9 E( U$ M* V0 Xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( s, ?( s. \2 ?7 I0 k- S% W
write('</ilayer>')' k2 E% d; R$ ?; G: v& T
}0 C0 O; N% n/ f4 k7 v0 M0 k6 }
document.write('</td></table>')
+ y% O, m( g' Q6 a}
9 }! X; W4 ]9 A, p: ?3 Q( T) u! @}
$ j% L, c- t$ o9 \- Z9 |: s) f" L</script> |
|