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

|
网页之跑马灯文字特效
//修改宽度
1 S9 }4 u" P/ qvar marqueewidth=3004 U# {& l- b( e0 n f
//高度0 ]! C8 k* l8 e& l% O0 a
var marqueeheight=25* I1 [1 b A& H2 ?" ~
//速度(1-10)
+ r/ ?- o- S% Vvar marqueespeed=3% L# I, ~, ^3 v3 X$ N* J
//背景颜色
* M. ?8 i, o# f7 C+ S7 ^6 @6 }; C. dvar marqueebgcolor="#FFFFFF"
* _$ q. k6 t" [, v/ b//是否能暂停 (0=no. 1=yes)?
$ ]0 [' M8 ]% C/ p9 Cvar pauseit=1$ x3 h, V! Q H" {4 L5 ]6 O
1 M, t. J7 D# Z+ J. Y) U
//修改显示内容0 U7 h$ z+ _2 e7 ^, L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( ?8 [# N( @: N& Z, v, G
+ S0 ~9 I. o: u2 c5 h4 q! d% D$ i$ A5 O: R8 T& p+ d
////下面不需改变////////////" y% B: W3 J0 m# I4 [8 |. d% h/ K6 h
( J# `- Q9 Z( k% h
var copyspeed=marqueespeed; b5 T) }3 o7 W l" O8 {1 J1 V* D
var pausespeed=(pauseit==0)? copyspeed: 0
$ F5 Z9 m& D% ^5 r' Uvar iedom=document.all||document.getElementById
" ^' V- \: Y, c1 @8 ]if (iedom)2 y3 O [5 r' L ]6 _
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 f/ L1 W( X$ m& Y% c# K( d# b* ?
var actualwidth=''
- I* Q, D6 Q4 b! @var cross_marquee, ns_marquee1 @% ?0 [4 T: w( Q
+ v! T$ [. C0 R2 ?1 dfunction populate(){& M+ j7 [. i" \+ ^ ]
if (iedom){0 a2 U9 S! F/ u- c0 X
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 X7 ~& t3 M# {; _/ X
cross_marquee.style.left=marqueewidth+8' H+ @+ f* V% z: h/ g' o* f: O! R) d
cross_marquee.innerHTML=marqueecontent: l3 d7 G7 X- J7 O& Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 p, {9 J5 c% b+ i
}
; k& D( e; I- Felse if (document.layers){7 F9 E4 A! H1 r, S: Q/ _2 ]' X
ns_marquee=document.ns_marquee.document.ns_marquee2( P% T1 \: [+ s: G
ns_marquee.left=marqueewidth+84 R" ~; I9 N) w+ v3 ?4 p! o0 t5 u" H
ns_marquee.document.write(marqueecontent) \6 _, c# x* {2 Z: |* Z
ns_marquee.document.close() A X/ X; w6 E N( ^
actualwidth=ns_marquee.document.width
) Q! P" T9 f% Y3 `/ K}- Q/ r4 p/ w8 f& S+ D' Q( {
lefttime=setInterval("scrollmarquee()",20)
+ O6 w3 N. @5 d! \- W9 U, M! E6 T6 n}$ C) ?7 S; _% o! d
window.onload=populate& h) p7 _* ] c- |2 {, A4 B M- i
& f, S0 v @4 @function scrollmarquee(){* H! s4 T' {! P9 k
if (iedom){
8 q/ d" Q' Q5 qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): Y8 s( ^8 y. [8 u/ I6 Y9 u8 n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' I' u6 G: Z4 ^ ~9 G" d, R: }( A
else
) P- E5 c) [# n! V- O( tcross_marquee.style.left=marqueewidth+8: L) U6 z% M, l$ S3 m; S. o
+ q6 ]4 x: q) e1 R& q# k) ^
}
! l9 u. P6 }( selse if (document.layers){
8 C9 g: }7 k% B. D# b& U2 jif (ns_marquee.left>(actualwidth*(-1)+8))
6 T/ V5 c' b8 i' ~: w1 qns_marquee.left-=copyspeed
8 L- x- [ i0 L! `: celse
; A1 ^' T N3 z# `7 {" f7 wns_marquee.left=marqueewidth+8
0 }" K& t! `; C# W9 y}
- u) w9 p) [8 H$ F9 V}
' s' z* }/ R7 K' }
7 s: u* }6 V7 G a2 `% Cif (iedom||document.layers){
e2 d: {7 Q1 k- j6 H0 Fwith (document){) i2 e- ]0 } Z' k/ v
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# {+ o9 n# j0 a" m9 j1 G' L
if (iedom){
* V9 ~. u( W% t6 W* g3 Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# b* o% ]) S& L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') F+ P& c; {" }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ U. \! L; d3 Z. f( T( ~6 W6 d
write('</div>')
, ~. ^, I- D3 j; o( {0 s}
) d: W0 Z; D. r; T' G5 T- ?else if (document.layers){
. F2 k- b4 A* G0 ]% D$ d9 Bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 `/ @" T0 r- j" k7 `! q8 T d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 M$ f/ M: R2 |, I* F+ kwrite('</ilayer>')
7 s# ? N% w" G5 s}4 x+ g, H3 N ~% t
document.write('</td></table>')* V8 c& \0 C1 V1 B2 ~
}- e- a' _" N1 m( A# r: J
}/ ^4 M$ t& V% I. ~4 x) v
</script> |
|