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

|
网页之跑马灯文字特效
//修改宽度
' i. _9 L! m: k4 dvar marqueewidth=3009 X0 [2 N. L. K
//高度
' t- z' J* T+ {' m: ivar marqueeheight=251 ~$ G1 U9 Z4 X
//速度(1-10)
' ?( l$ s# x; {4 B- {$ L. s! Cvar marqueespeed=3
, C4 K( U' V7 m# H1 ]//背景颜色
: H! H1 w2 @4 g' L) c8 P8 Qvar marqueebgcolor="#FFFFFF"" K, K9 _8 N7 c; K" h5 T5 I
//是否能暂停 (0=no. 1=yes)?* J1 [9 R4 e7 B& \
var pauseit=1
! v% V& h& \! a- J) F% G. _* E2 A7 S R+ y: h0 x
//修改显示内容
0 M+ z& Z2 ?3 r6 r) `; dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( c& I& \- b8 ?2 N4 x- y6 N( m, Z' l. X! `6 I1 V) [& [
% K6 {# u( W- l' R6 [3 A0 h
////下面不需改变////////////
: {& u v" g! A4 t; _& N' z; d' v4 q3 }# ]: O* M
var copyspeed=marqueespeed
" p- q6 d* t( j$ R( Bvar pausespeed=(pauseit==0)? copyspeed: 09 _" a0 G) d3 T- m% O: o
var iedom=document.all||document.getElementById
% Q8 X2 [" n9 o# y0 G5 y4 gif (iedom)
! a5 ^4 j( }! Q/ I `( x* `* |document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): ~2 ]& h4 P: _; Z
var actualwidth=''/ p% X5 f4 ]5 U
var cross_marquee, ns_marquee% j: ~$ C. T+ p8 m' s* w
- W: A' {! G( n
function populate(){4 y4 L/ Q; t! _+ F, H1 l$ k$ `
if (iedom){
8 z! R2 g) z, L% m' [cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 `5 r; u9 ^* [/ q8 N( L
cross_marquee.style.left=marqueewidth+8: ` i l' M7 t& b3 `
cross_marquee.innerHTML=marqueecontent
( m; [# N3 Z) a. Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 z0 {$ M0 U; v& d}% _- R' J! L7 {* d
else if (document.layers){
1 \' C- Y0 m9 h9 Z% `8 xns_marquee=document.ns_marquee.document.ns_marquee2
9 R. Y, I$ E6 I7 w( |5 _ns_marquee.left=marqueewidth+8" `5 M4 a4 |9 C" z6 j
ns_marquee.document.write(marqueecontent)
" t& R$ y; x1 M8 j" @ns_marquee.document.close()% Y) L& s8 s1 E. O$ Y Z- H
actualwidth=ns_marquee.document.width
/ G1 k O# m) Q: l0 K1 Z$ `}' b% s n1 l. l6 C! i2 {; D
lefttime=setInterval("scrollmarquee()",20)1 U, _; k2 B8 C! j7 p8 w9 @
}
& o, K! k: e* a2 L, I+ [" U; _7 [window.onload=populate$ r! p( X4 n6 X/ S/ k( Y5 E
! q- U9 s+ X h* {4 m' @+ i; l
function scrollmarquee(){- |. Y' g2 `7 P
if (iedom){
0 `% ]# u5 ~. e- E" n4 `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, o$ W6 k/ U: E5 J/ e* ^# h/ O2 W ]cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; y% `9 V# J8 F5 Xelse
2 A% m$ G- `4 @% ]) ccross_marquee.style.left=marqueewidth+8& e. f8 V: A. y/ e, J
5 k# {9 z0 H' E8 P* I6 o
}0 L+ M" p) w! Q) h0 [- Z! W0 m
else if (document.layers){, V$ B4 T% | V' v/ o, I6 m
if (ns_marquee.left>(actualwidth*(-1)+8))
* o m0 r# f, P. j2 sns_marquee.left-=copyspeed
, ?+ s; {+ K, n# H6 L: E) i8 r3 ielse
) B5 H2 q& m) u1 }- \* Gns_marquee.left=marqueewidth+8) a& L1 m" K* E' T. @: v# p
}% G: u: `4 H4 o' M! m
}
* O: ^/ P5 n- ^) v
$ U0 b8 ]8 H4 r$ v" [ m& R0 Gif (iedom||document.layers){
9 [: p0 F6 m2 t) r5 ~with (document){7 x, W# k! O7 i, ~9 Q5 S9 M9 @
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) \' o- p& [% Q1 t+ T4 ^ tif (iedom){ D$ }! W5 |5 Q' M( x# g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 b8 f2 |5 G" w' s, b1 B. P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' m- F# R' d6 l# o. L
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! f- \2 l4 J" o$ N V
write('</div>')
" C6 P3 O2 @( o1 @8 ]* ?/ B$ K0 t}$ |; S6 K1 _2 o; I+ _, Y
else if (document.layers){
: t6 Q% G* r, T6 z$ Qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ c% y5 l3 D! n) Hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 p& [( D. W) d; u1 U7 F* xwrite('</ilayer>')7 R u2 \( v/ E) ~ w/ K
}
( ]# f% s! ?) Q2 T$ C5 k8 r9 L& @( udocument.write('</td></table>')
9 d- u/ m$ [. _% T: J}
( ?0 p7 i1 u$ I* n1 M}7 G2 R- d f/ j$ t; a0 E
</script> |
|