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

|
网页之跑马灯文字特效
//修改宽度& A. b' F; k, [2 } U K* M( s
var marqueewidth=300
2 _1 p P" h/ k$ J" u//高度
/ r) N) J6 e; V* {9 c* N9 l6 P' uvar marqueeheight=250 x: {$ u4 x; C" Z. `
//速度(1-10)
( C. r& h& v/ v. zvar marqueespeed=3
- H0 n3 `- R! k$ d; H2 \7 K//背景颜色
I' q3 `5 y% x+ @var marqueebgcolor="#FFFFFF"
) p2 u4 q& M9 M* M" u//是否能暂停 (0=no. 1=yes)?4 C1 ]. ?, R3 q
var pauseit=1
$ @/ J4 ]+ L% ?! k
0 M* x: t# B9 Y. \$ ~9 T3 d, m//修改显示内容8 l% m" `0 R& l* s% c
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( L6 n6 H8 S @
; B3 j9 e f& w" ]% ^0 s
9 ?/ a5 @5 `3 B/ ~1 N////下面不需改变////////////
N" _# c0 D; R
1 D& c) J& n: m2 A r! S- ^( Wvar copyspeed=marqueespeed# Y+ Q& j" y5 M' X/ o; t
var pausespeed=(pauseit==0)? copyspeed: 07 ~ P M; `+ |4 H
var iedom=document.all||document.getElementById8 `/ \% T0 w P; h; n. q/ n2 f
if (iedom)) Q% y) K% {1 G1 ~0 n% s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ q- M4 K9 X0 B" X5 H4 I9 b
var actualwidth='') c# G0 \' P- ?6 x0 ~3 h& M9 l
var cross_marquee, ns_marquee$ v0 r+ h. L: J5 \' `4 D" M
L T; O: i! B3 K$ hfunction populate(){- ^0 N/ f. j7 K- G
if (iedom){1 w9 O- t& l+ S/ j3 S1 W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" F& W* F" E3 B# m5 D# U
cross_marquee.style.left=marqueewidth+8) t6 C5 L% H3 n8 {
cross_marquee.innerHTML=marqueecontent6 h" D3 Y. C1 t4 z4 q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: l% }* x H! D2 W) [% t}6 _, }/ P- f5 A% a6 W; z# o$ c& R
else if (document.layers){
8 J& Q! `* {- b7 e0 r6 k" u) Gns_marquee=document.ns_marquee.document.ns_marquee2, J4 v6 f h/ e
ns_marquee.left=marqueewidth+8( r" ^/ i' @5 j% D; {4 v/ i5 M ]4 T
ns_marquee.document.write(marqueecontent)% x' q: `% t, w; ]+ i
ns_marquee.document.close(): Q, ]8 S% y. C. ~
actualwidth=ns_marquee.document.width
6 M1 n- V# S0 @2 t3 e6 Z4 a}
; z* g5 ^9 N4 P9 x, H7 u! C. q' C, olefttime=setInterval("scrollmarquee()",20)
+ m; R+ ~' J2 i' x) f}
' ^+ _; r- p# U9 Vwindow.onload=populate: j1 ~. O1 A0 l. c" [: o: o
" v4 o- Z- {0 b$ S3 a" a8 N
function scrollmarquee(){
: ?6 M7 y* C0 p8 wif (iedom){3 t( m- o! X% [ N" i
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% ?3 q* Y7 s% u8 N# Wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 y4 a9 I( v& P% D6 g+ ^else
3 v4 y7 A. N2 T1 F9 u* M7 Pcross_marquee.style.left=marqueewidth+8
% a3 s" h8 q% B& X/ k7 o1 f; Z7 U9 u$ m) s8 b
}
3 B3 ]* }& L3 K# }% p; Velse if (document.layers){
0 P5 `# Z4 j, y' m: Aif (ns_marquee.left>(actualwidth*(-1)+8))0 ]: V' a8 w# Q# x, r' z3 q
ns_marquee.left-=copyspeed$ K3 i% V5 [% L7 v' u# e: k3 K
else- I) n. U# ^1 \
ns_marquee.left=marqueewidth+8+ z. O& j4 E' J+ K' W9 e
}
' K% }7 y) v [9 W}
' k3 j9 U& Q0 L+ o+ D+ T6 ]% f& w" g" V3 u x" S
if (iedom||document.layers){
; K7 F4 q. O: v& V+ Uwith (document){
2 E* p2 I, P3 W( q3 L% h* o# Wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& n/ m0 U. q! T2 _3 [6 R
if (iedom){
6 j B; w# C7 W6 M1 Z7 _2 J. @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( V& l1 b5 V- o5 k" T) e4 |write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) U+ {# B% J# z% c1 [3 \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- G, ^' K) K2 B, b2 v! ^
write('</div>')
+ K- E; V1 }7 n% _/ B1 Z9 |) g}
; M$ G2 W2 M, i7 w1 melse if (document.layers){0 C/ j7 _ z- F' n$ n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 s! y8 ^7 ?# Z, U, p
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! {# d7 K2 X- c0 e8 k7 Hwrite('</ilayer>')$ R- i2 ?4 R4 R* j9 O( f
}2 ]0 D5 l2 M. K5 V( [
document.write('</td></table>')
7 A$ G, \: m: Q& k s}
' w5 S7 t% }; a}
$ g6 j1 z1 `0 B X$ h</script> |
|