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

|
网页之跑马灯文字特效
//修改宽度" Q0 j6 u# b8 k
var marqueewidth=300/ B1 _6 h3 _! T: ~* j9 {; G
//高度
6 A& o5 [0 ^6 X) Ivar marqueeheight=25
) O: d/ M; G- [2 i//速度(1-10)
9 w; z% J; U, h$ S* \) ovar marqueespeed=3
/ T o f4 |- ?! ^* g//背景颜色
- S7 k2 C6 r. ~# Y" C f+ u2 avar marqueebgcolor="#FFFFFF"' {" |) a; _4 d( s& Y+ h4 s ?/ X g
//是否能暂停 (0=no. 1=yes)?
; T3 t9 j: w3 A; ivar pauseit=1
' A, p7 g: D, }
. v5 W) u# T- @9 T//修改显示内容
5 O1 R% P& u* m' c: Avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" Q f/ v# W3 J$ k3 D
! E0 ?3 R# @) m# a( D% A% g1 v6 j
* M& _/ Z/ a9 z( G3 N5 @5 f. l////下面不需改变////////////6 w7 q1 _6 Y6 w( ]' t) W" p
6 s) V- ~ q( q* T
var copyspeed=marqueespeed! @+ U# W" J5 t4 d8 A8 X
var pausespeed=(pauseit==0)? copyspeed: 0) I* Q3 E& t8 l4 ~) L( ^5 `
var iedom=document.all||document.getElementById
" H. ?5 k- }1 a* ]0 a* ^if (iedom), p+ W4 m3 A6 `* V
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 o2 H: y# w0 F# _4 m# Fvar actualwidth='', X- D9 Q" n3 L9 I( {7 _* M# _
var cross_marquee, ns_marquee
) r: G4 O* R& Y
. q) Z" n+ C& R6 h6 y6 m3 efunction populate(){1 @ ]5 d/ I' W3 i E! i7 }
if (iedom){
# m |1 ?8 ]9 n: {& M" y8 s% Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 W- G( M- M2 c7 o/ A7 _6 E
cross_marquee.style.left=marqueewidth+8
' l1 T8 g; s( ~% K- y ucross_marquee.innerHTML=marqueecontent0 u, ^, R5 S4 F5 Q* j# S
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 M: | i- O ~% k, y# F: r
}) ^7 S0 t0 m9 _ G1 K
else if (document.layers){5 M, ~; w6 n" t2 V7 P3 {2 Y7 K+ ?
ns_marquee=document.ns_marquee.document.ns_marquee2, T& [: I# q& w* h
ns_marquee.left=marqueewidth+8% h" |$ y2 v$ I
ns_marquee.document.write(marqueecontent)2 b# K) F- ?9 ^) g/ c: a. P; q
ns_marquee.document.close()
3 t. n ~. H# S6 A: r' O9 factualwidth=ns_marquee.document.width) p; [5 ^& v0 c% g3 D9 u% i- f/ C3 p3 e
}
0 b$ y- ^9 v2 Y! \8 `lefttime=setInterval("scrollmarquee()",20)
% o3 N3 c/ D \0 T1 B$ B7 f" V}& l# k/ E* @. d" f [- M& S
window.onload=populate
. c+ I# E; v; m. S6 U+ A: O
) c3 K/ V6 x7 S/ q* @% l: p$ t2 Hfunction scrollmarquee(){. \4 `" E# J1 n
if (iedom){
4 A; U- c1 ^9 Y1 J, u7 x' B; fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, ^ S, {, n( L; s2 B* ^5 }2 Bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- T% X, Q. p: y! n+ V9 b
else) m+ C% P9 h- \5 Z' F
cross_marquee.style.left=marqueewidth+8
+ O; g* y6 N v' L. k
7 o5 o5 X3 j# C}- h; S: e% {( f2 y# B
else if (document.layers){
& a- z# A+ t+ `if (ns_marquee.left>(actualwidth*(-1)+8))
7 {3 M2 N A, D4 ]& Z' ?& sns_marquee.left-=copyspeed. p& i1 ~3 N4 t+ K8 A
else
* P# v0 ~, q% \8 {) vns_marquee.left=marqueewidth+8
$ Z8 v4 [9 D+ }4 ^}% r, d" ?, L. ?
}( ?6 y4 u1 y: B' g3 O5 E& I
) Y. F3 y8 t0 Q$ s5 Hif (iedom||document.layers){8 G3 z: ~: {* X; h
with (document){5 M' W. |. P W6 K/ [ H* c
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- u& B- C5 V D1 o/ d
if (iedom){
8 Z: w K: H1 }: L- z% m9 l0 m& Y( C: Hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 F+ \2 ?% V0 ~1 F# {- mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( X+ D/ _7 d& _1 Y$ \4 y5 `write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): w. X# C3 H/ O; m; `7 [
write('</div>')% v: f8 z8 d# k9 ^
}
8 x/ z: E0 v2 L2 X* o* l" xelse if (document.layers){8 B. `9 [/ y; K7 J4 O( G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 ^: E) I f5 k0 bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): ? P9 ]/ L$ @+ C B. [( b
write('</ilayer>') G i5 B3 B. @
}
) H, M c, j. @4 ?* p) Ydocument.write('</td></table>')' E, ^1 d7 l( N
}
1 C8 W; v, u- o; Y2 j/ T, o" M( l}
- W" X N' @: g) t* m6 ^</script> |
|