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

|
网页之跑马灯文字特效
//修改宽度
0 d9 {+ s, W6 Z3 e) f3 T2 V, ovar marqueewidth=300/ N) W/ n$ X, |9 o5 z5 P# t* m
//高度, }5 U0 K% q0 G0 |
var marqueeheight=25% v4 W6 H- ^: {: y. Z+ I
//速度(1-10)
* P. ]; S; `! J" pvar marqueespeed=3& |6 f. f! r" ]
//背景颜色
2 \" X) o5 _/ A( Lvar marqueebgcolor="#FFFFFF"
6 e6 a. K, c2 V, r6 ]) q' _//是否能暂停 (0=no. 1=yes)?
7 v- X0 e: o3 m7 q y5 H. Xvar pauseit=1- ^. I1 r0 r3 I: K# C, k& _, r8 K' j
1 `' C3 M7 k) T9 a, T: j//修改显示内容
$ G& h# _4 u" a8 `; E; F6 Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ ]8 Y, i$ M0 ]8 k( x) g
2 t# | R% Z! p; s6 g! @7 W% r; `- J' x: A; z
////下面不需改变////////////8 l+ M9 A6 S' C# K7 R
0 `: [- h+ Z" `/ s: d8 v
var copyspeed=marqueespeed
- L% q7 q7 d$ ~1 ~9 {9 i! ^% Ovar pausespeed=(pauseit==0)? copyspeed: 01 p# _6 j/ n P8 D2 {& e
var iedom=document.all||document.getElementById* |; H9 G3 v. `# C) Z& {9 X- k
if (iedom)
; s. X$ ~% K' u# l4 kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
W8 u+ V& H" O. X6 b% ?var actualwidth=''
& j6 N; W8 V* ^3 _# A* G$ Svar cross_marquee, ns_marquee" ?1 B0 w: g: Y _% ~6 T% ]* M
( [/ O4 \( Q; M+ q ^
function populate(){
$ h# f7 R' [ V) K- Dif (iedom){& c4 f4 t7 d6 j" L+ h
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& v. K/ g# I( [3 Hcross_marquee.style.left=marqueewidth+8
# m9 A/ z: {; ]" `# f& E1 x0 Z$ j" ccross_marquee.innerHTML=marqueecontent! Q$ e7 n5 y" K- L5 c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: E- N B6 \: q- L {}
1 i9 J1 F+ c' @$ T/ ^else if (document.layers){
3 k) C; V4 `8 t- x& l- E" n$ B4 Ons_marquee=document.ns_marquee.document.ns_marquee2$ |/ R; t2 `9 C- d& S: R8 n
ns_marquee.left=marqueewidth+8
, ~' d8 \+ Z& ~& z4 [7 G" E- M! }ns_marquee.document.write(marqueecontent) B, ]+ Z$ M9 Y- U
ns_marquee.document.close()
* m h& I9 M3 |( h- M, Mactualwidth=ns_marquee.document.width# `4 A& I9 Z3 g! R9 ?6 S8 o; N& }
}( j( F; U: M- u5 f$ p
lefttime=setInterval("scrollmarquee()",20)
& n; e. i k3 f. ^. H}
5 N$ G8 B6 J- g' Y( P6 |$ owindow.onload=populate$ c3 e2 O% {4 }4 ~' r. Z+ P
4 e1 A* b, b( Y/ Kfunction scrollmarquee(){$ ^+ S8 y6 K3 r
if (iedom){
0 j9 [, n$ H/ j3 w4 Uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) T- k( `% i* @- ?% {; b* P0 kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 s" f# @% A, Jelse
$ i3 E* @: Q6 n* P9 y7 Ecross_marquee.style.left=marqueewidth+8
4 _" n) W3 ]0 v' K3 w$ u* S4 _
. ~9 V% M2 l6 @, \4 ?8 F3 `}6 O+ _5 H4 M2 h" j
else if (document.layers){& p- @8 l4 X5 W _
if (ns_marquee.left>(actualwidth*(-1)+8))/ z t4 H- |3 N0 M* h* |
ns_marquee.left-=copyspeed% R+ D8 K6 [" Q0 g- i
else" r9 S* ^# I7 q+ ~& B
ns_marquee.left=marqueewidth+8 O% p% L0 G, z0 M# r, q6 Q7 O
}
" u8 Q+ ~. z3 C+ o' |}( V: G" p& ?9 l6 E/ e% m, r! V6 t
* y5 x2 {8 y1 c S! i/ Eif (iedom||document.layers){* {7 N9 b# ^0 @& y4 X( L+ f( c
with (document){" X9 R M5 n0 A" p) `
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ [. U4 o$ J, M: @6 Lif (iedom){* m3 f! {, I7 J, s
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 B( U9 M; n# u9 a& S& `4 T" m
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): \5 w9 M3 C: C. E6 `
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 v# G4 |$ B5 q Bwrite('</div>')6 V _1 J$ V. g6 \) g
}/ T) S1 v8 b, b8 ]5 j
else if (document.layers){( I7 t+ U% j3 \
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* p! E- N# m# ]# f& P
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ `. V& c; A4 {& m: p: y3 ]5 H
write('</ilayer>')
6 c0 E& b& R+ q9 V1 ~4 \5 Q}4 N% J1 U8 f! o
document.write('</td></table>')
' I0 k; `7 v* A4 B}; I0 E2 G% D* T: m0 p1 x+ x
}7 Y7 J# q% m [
</script> |
|