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

|
网页之跑马灯文字特效
//修改宽度( A4 G: u) j- b, Q) S; _
var marqueewidth=300
5 z' w. X9 ~ I( E7 ^//高度
+ \! c% A- A5 H% y0 V' lvar marqueeheight=25' G* R/ A! u p
//速度(1-10)
& I, j5 N+ R1 N4 c: o1 ^# evar marqueespeed=3
: n8 C6 @* M' _' ^( C9 J" C//背景颜色+ s# i5 |& W! G) a) R
var marqueebgcolor="#FFFFFF"0 T" Q3 v! z3 n* M3 _
//是否能暂停 (0=no. 1=yes)?: C: J: Q* o# V( }; E# l5 K
var pauseit=1
! C$ p9 j& P0 {
6 t3 N) X3 T- K3 F: ~% e//修改显示内容
3 i3 Z, P# _) N/ ^1 svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' ^# M9 H9 s j( j* O
2 N$ T9 [* b E/ A& d6 u
* m+ e1 h/ [/ c: i, L9 d9 s////下面不需改变////////////+ J$ z8 L0 y J" ?5 e) O2 Q
) G* w' e* U( A1 x9 h Mvar copyspeed=marqueespeed
# H) e6 E, y Q" xvar pausespeed=(pauseit==0)? copyspeed: 0( T, B4 G. w' c: Q: w7 ^
var iedom=document.all||document.getElementById& g" t; X5 z( b& W' V! E+ i. X7 [
if (iedom)
5 a# Q$ F+ P% G( P! V0 X2 C) F8 {document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# H: N$ l; {4 A4 Z7 n3 H
var actualwidth=''
4 Z& p. W2 u- `# W0 o ]3 @var cross_marquee, ns_marquee
# a+ p0 u8 P9 B2 o& l4 ]8 L$ f+ R' q0 G7 w- I0 ^! |# K8 O
function populate(){+ ~! f) Q9 X$ j
if (iedom){
$ F0 `8 C$ \$ |) M- ^4 W. z( Xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ ?' r( v, c) O4 r
cross_marquee.style.left=marqueewidth+8; q7 I( Y6 W7 E' Q% }/ d# z( `( a3 Z
cross_marquee.innerHTML=marqueecontent
! m: T! h+ T1 R( n- L- Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* u: l" o7 Y0 Y6 j
}
% Y1 N) y. M7 @2 {: D1 L9 Uelse if (document.layers){
0 i! U' E# e" r# b% kns_marquee=document.ns_marquee.document.ns_marquee2
1 n! j# J) d* ans_marquee.left=marqueewidth+8
- H# \" C6 W' v6 w4 A% ~0 ins_marquee.document.write(marqueecontent)( h5 f5 w( t7 J/ B3 M/ g0 K
ns_marquee.document.close()4 m9 K2 S% ?0 L/ A" I
actualwidth=ns_marquee.document.width& v/ d. X( Q, f. p' a" a
}% I4 ^! ?) w% K- Z$ p9 p
lefttime=setInterval("scrollmarquee()",20)
. E# a: \0 z- M}
?$ r% Q G. ~window.onload=populate
( W' Q; x3 L: v! ?2 X+ z i/ ]1 M6 r. A: K
function scrollmarquee(){/ n$ \8 i2 L1 q/ l5 ^- t) G- f9 g
if (iedom){8 Q% E; Y, J/ i2 I4 x3 l. t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' k+ R1 L0 G. P% m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; [$ K" @2 r& L1 `" @6 c, e
else# b% S8 q3 P/ ^7 ?' m; n" H
cross_marquee.style.left=marqueewidth+8
! H" M+ H7 o4 B: n5 i7 P6 ~9 f, |
" \- B' O1 B2 S}
, T+ B% [( h3 g/ Y# I7 relse if (document.layers){
' r" g8 T% U5 D2 b7 k% c* L9 Tif (ns_marquee.left>(actualwidth*(-1)+8))
4 q( r. K- a v% I# Wns_marquee.left-=copyspeed' s6 h5 C+ @% G' e R2 O! A! y4 K
else
1 W+ C6 b/ k9 s* v5 ins_marquee.left=marqueewidth+8
4 D# D4 p W# ]' ^}
( n8 A" s7 I5 }/ B* l}
+ {2 n/ `8 b1 Y1 G
+ X" Y. J. M. j4 Nif (iedom||document.layers){
! a" }7 [ W% Hwith (document){
( S" N& S& n" P1 Wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 b# U% z7 Q7 o) E2 J# c; p
if (iedom){
+ H' C1 f5 U7 t1 Q8 ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: K2 S5 v" e: x6 {3 ~0 \0 w7 kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), a3 k, ^1 y# g5 x- `) r4 ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 ^/ e% v4 Y( A' P3 d! H" U2 k( e
write('</div>')
: B1 q+ W4 v! u `) A- a}( K" p7 t3 E+ s9 [+ p" D- B: A
else if (document.layers){
^$ z, i6 p* ]! l7 @' twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 J9 x. i' r& [$ k7 i( Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ r3 \/ y# `" F+ p) b( v& n; X. V4 ^
write('</ilayer>')
5 I- w2 t7 ^& G/ L+ s+ w}
h$ y9 U; j$ C+ r$ ddocument.write('</td></table>')
1 Y6 p& u3 _ Z}) r9 J4 ^7 H* B% e9 }1 z: D, k; s4 q
}
^7 b* N1 u- l3 F7 p2 o</script> |
|