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

|
网页之跑马灯文字特效
//修改宽度/ S2 c% w9 v2 W# w4 M
var marqueewidth=300* v+ u' Z4 B3 g/ H; L9 |
//高度
# M3 l% f- d* @8 v3 \var marqueeheight=25
$ g$ n( L( P( m, r3 e \& s4 E//速度(1-10)" s. w1 U: U; H) c* H
var marqueespeed=3& \2 k: s% ?6 c6 D! Z
//背景颜色
' f1 J% X ~/ U3 {* P; e& E: x: |var marqueebgcolor="#FFFFFF"5 h1 \) P4 K, Z2 K
//是否能暂停 (0=no. 1=yes)?7 P5 P4 A( e) \5 a8 w, u
var pauseit=11 w1 W" ^' S( X" i" l+ u. I1 S
+ r3 t) }6 d e! q6 T1 C
//修改显示内容) u% T6 {0 b, e* F
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
x+ P3 ?; L0 ~7 D
# q/ c( J" d1 h& t$ [# p7 V& ^( a" E0 z3 m4 M# j( _- X
////下面不需改变////////////0 E( U6 f/ N# K/ f$ W N4 L
/ |: D7 C. z- m/ \7 L' Cvar copyspeed=marqueespeed& f$ {8 i8 w0 h4 [' N/ Y4 d
var pausespeed=(pauseit==0)? copyspeed: 0' I0 b" ^; U6 o6 O8 }
var iedom=document.all||document.getElementById
: b3 B _' `( [( Rif (iedom)
& I1 ?. p2 n9 ]0 Tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 J) u ^, Z9 y+ u- u1 V- b% @: z
var actualwidth=''
- o* E' `: T. xvar cross_marquee, ns_marquee
: C9 T. o% i9 [, w3 ~5 F7 t }1 c# a3 o" N2 ?. A r9 f& k
function populate(){
! e" J1 A( z! l; gif (iedom){
# U, a) r- m0 q4 G4 wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ ~: O( B. V' U7 o( n0 Ncross_marquee.style.left=marqueewidth+83 ^7 c4 Q; [1 O Z; T4 C/ y" t
cross_marquee.innerHTML=marqueecontent% E: ]8 ^& F& |+ B9 J" T; i
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& k; k3 ^7 J9 E" n' o; R}
7 J3 Y; ?; t8 R) B' [; }4 e: Melse if (document.layers){3 d5 D, |# d0 E. G5 _. g
ns_marquee=document.ns_marquee.document.ns_marquee2: o+ I; k; v- r' x5 K0 d, W* `6 {
ns_marquee.left=marqueewidth+8
' e, P! l- W- T! d% s0 _ns_marquee.document.write(marqueecontent)0 }: T j- I7 n6 u0 A! Z8 v3 v
ns_marquee.document.close()1 @3 O2 c! e) U! ^4 K |
actualwidth=ns_marquee.document.width0 r9 d7 m7 P* Y5 Y; u y
}* b( u F* k" p' f7 l5 t' u
lefttime=setInterval("scrollmarquee()",20)3 k: l6 b( c- @: a& D- q
}
5 X' M: t, E' Q( U8 J& N8 jwindow.onload=populate
$ G: I) X5 E* q$ |/ v" k8 \- U0 E. J( M4 l5 O
function scrollmarquee(){( z! A6 M# [5 ]( _- b; S! J
if (iedom){
* H# ]* l9 I+ A; i! }7 t: sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). C R9 |7 u! ~/ c+ Y
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) r7 Z N& z% |$ c# ?$ b; @% delse
- x2 \6 g9 H; d( D& h* e# `/ l, Dcross_marquee.style.left=marqueewidth+8/ ?2 ^! H1 S+ X. Q! J2 v
9 P: X* B1 B( f0 p* a}
+ E$ F# V2 `7 F G# xelse if (document.layers){
& D8 p) j7 L1 ]' W$ Gif (ns_marquee.left>(actualwidth*(-1)+8))
' W; s) E( _3 A$ D) o3 ^1 p2 |" ons_marquee.left-=copyspeed
2 |: x) S' d: {9 O' P$ @else
) _1 a( e2 ~$ Q8 L4 {4 U% Qns_marquee.left=marqueewidth+8
7 V3 w4 z0 ]+ K" \6 Y/ l}
g8 [2 S: _# `- Q' D: X}. `( J# R0 S/ [) i# Q
8 v. V$ Z1 B6 w+ a
if (iedom||document.layers){5 ]5 k9 z! k4 u, t& L. U$ ?. u
with (document){+ n3 W# |$ `& t$ @% l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); G" D% O' e6 y7 t6 `
if (iedom){
% `6 j* |$ V0 ^) Q, E2 G% E# Owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 N1 g0 i" b/ x* }4 qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') n% Y: b: W# X- r% b4 `7 ?
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 C, b- j& T" d: W7 p2 N& {write('</div>')
6 T) Z9 e; a2 @7 q}
8 y& O- H* H4 x) ^+ o2 Celse if (document.layers){
* a- }) w. M8 l3 {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 _; A2 i0 J* ~% h; n- ^: |- F
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 ~9 b$ a; v# E ^: K
write('</ilayer>')7 j8 m( I' f; t& x; _ M7 C
}
7 T" \; y6 |. g6 U+ y& Xdocument.write('</td></table>')9 j$ g( s. }$ `- h' N
}
/ Q5 b- [5 Z1 o7 w6 w5 h. ~}& j" u0 { {, B% C& u6 g1 q
</script> |
|