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

|
网页之跑马灯文字特效
//修改宽度
# q% v, U6 r1 u( k5 L2 i+ }% `var marqueewidth=300
5 A8 _$ F) d4 p3 f' M# O' }//高度5 @) T) K+ M3 S/ S$ `
var marqueeheight=25
; m; j5 x& P' @1 A//速度(1-10)+ l0 A' T% ^9 t5 D( z* d N
var marqueespeed=3
) l! c) g3 k' f3 E//背景颜色
4 v9 v) {3 A1 ~var marqueebgcolor="#FFFFFF"
8 u' Y' l" W. z$ }& s" _//是否能暂停 (0=no. 1=yes)?
* p2 W. F. @3 y4 I' Dvar pauseit=12 q/ v; Q' _! G$ l, j+ F i7 r; \
3 E$ p/ \/ k/ ~- J( H9 n
//修改显示内容
5 h7 ~ L" Q# A0 U6 _# bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( }( S/ }& e1 O& V
$ W! A# q: f8 M' |( S. k# P6 ]' \) C' R
////下面不需改变////////////
3 D0 O1 O" \& O1 a4 ?/ l5 j! N( ^5 i# ^ n$ F1 ?! `& x0 ]; l
var copyspeed=marqueespeed
5 B6 g$ p2 o$ N% I( M) Yvar pausespeed=(pauseit==0)? copyspeed: 0
* L! k1 g- R! V8 R6 _- N v% hvar iedom=document.all||document.getElementById& ?! s; \* {: w& l7 b
if (iedom)5 F: h3 w2 X* h8 \# f
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 N; z; i/ L `# M3 |
var actualwidth=''$ o* X( l/ R- y" P6 z+ r$ V
var cross_marquee, ns_marquee
% M5 e9 n$ j0 O$ h; g% b
% Y* }8 W; j1 D2 n% Z2 W3 f7 s6 Kfunction populate(){
. m2 f% Z! B v, V) H4 u% F" H+ wif (iedom){
) L% d& M+ ~% h8 |7 A5 U7 M6 ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( B( P* E! }" Z8 X0 C, T7 } ?& W/ ~
cross_marquee.style.left=marqueewidth+8
/ a$ {9 x* o: w9 ~. across_marquee.innerHTML=marqueecontent! d' u, v3 Y( n: L+ }
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# q `" G* X+ L, J( e
}+ C! y% \' s- F% X- ~
else if (document.layers){4 x8 Z. a, h. I# {
ns_marquee=document.ns_marquee.document.ns_marquee2
7 _! Y- L- \6 p8 o' k6 k( M' Ons_marquee.left=marqueewidth+8
* A6 [5 N$ a. ^2 L7 _$ X$ K* P. Sns_marquee.document.write(marqueecontent)& D( C9 w2 j3 v1 K0 W0 D$ D, T* b- H
ns_marquee.document.close()
5 ?2 r. r+ P2 @actualwidth=ns_marquee.document.width
. N/ h2 \0 c. O2 V2 F}
! K) @2 x% ~$ p! glefttime=setInterval("scrollmarquee()",20)
2 ~* Z6 t$ d C5 v. X}! `% w2 Q7 q" l! y9 `
window.onload=populate) o! X% C- H2 d/ Z1 D
) r. w+ q: m: c" l% i" [% y% P" U( hfunction scrollmarquee(){
0 h% }) S5 q% H5 cif (iedom){
, S1 E0 `* t/ yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" i, ~. z6 J. d" s6 ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% i2 x0 O2 K2 C
else% x( ^% N- O1 P. V; h) @' }# p
cross_marquee.style.left=marqueewidth+8
3 f5 r* S! {. |! n6 |4 P3 D& V
I" Y$ _9 r$ W3 I( _/ c0 [; F}
. g4 L+ P3 L% m' U. Belse if (document.layers){
/ T. L/ A/ r: ?' J3 M" C7 jif (ns_marquee.left>(actualwidth*(-1)+8))/ h* }' w8 a8 W) N8 F6 k/ l1 Z
ns_marquee.left-=copyspeed' j' ^8 U9 K& Q5 j3 o. {) s8 z
else
$ i; x$ n: d0 i# ~. O8 n1 O. j7 ans_marquee.left=marqueewidth+8
6 @7 a; T- a I3 [}( a' m/ b' `+ o. I" l1 k! j
}
, y; X8 B8 l9 J1 U8 {. D7 L6 \( o# }" i
if (iedom||document.layers){2 H( p. x0 F( t$ O' D+ F, r: M! g
with (document){
+ @3 S# m" D3 E/ M( |5 _5 Jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) \* ]6 M2 d7 D2 f, A# _. Wif (iedom){
/ F- b7 q3 ^4 b1 ~& Ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 o; S9 i3 `- t+ g, l2 u8 Jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), g# s3 L( S0 o6 c, g/ E( z7 K
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 e$ e8 a+ j B3 l3 G, \
write('</div>')
K" A# n- F# m1 P# ~}
. P, L1 e. i$ zelse if (document.layers){
7 }* {* B! E8 n0 T" P% Rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 s& W- q8 Q) \6 H, |% n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( T- A& k8 }8 |! mwrite('</ilayer>'): ]/ F8 K6 G8 r
}
7 N2 s, l7 W! m$ `document.write('</td></table>')
" _% j/ ?( P. k- x1 j+ y}$ g! J- F: C& ^. ^
}
- c+ S* L; J: ~$ D6 w" ?" p1 b</script> |
|