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

|
网页之跑马灯文字特效
//修改宽度# z( F; B( a* M p8 j
var marqueewidth=300" m5 o1 O+ R* R6 ~, p
//高度8 x7 q) p3 c4 {" o
var marqueeheight=25: t- }/ Y% m, G% Y' O( _" T7 j
//速度(1-10)
^% z$ V1 N/ E( ?8 `var marqueespeed=3
" l1 O4 z3 z" q$ ^4 U8 e: g# W p//背景颜色
( Q8 l3 ?( ^: ^3 x9 o9 ovar marqueebgcolor="#FFFFFF"
* a: g; k# W% S j, o+ e! K//是否能暂停 (0=no. 1=yes)?- i. M1 Q* b5 T0 r. R
var pauseit=1
! m ^' a: n, T3 @( i6 _* M
" f8 M$ V8 }6 F+ @& c7 z//修改显示内容& c: N$ Y9 E: C! w0 }6 @6 E: O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' [ x1 i |" Y
: v/ B* [& `0 Z( u3 c0 ~) U1 v( ~5 s$ o1 S( C" r, o. L! ?# _+ X
////下面不需改变////////////
" O3 d# M6 \2 r9 _: c0 N' U, r3 u
$ C2 W2 t& G, i, g, M( Ovar copyspeed=marqueespeed8 n: i6 u/ E" ^ z, H
var pausespeed=(pauseit==0)? copyspeed: 0
; ~7 s3 w7 n1 lvar iedom=document.all||document.getElementById0 t* v$ i7 S% A# @- A+ {) z# L* h
if (iedom)
+ F! p$ S2 J1 P1 ^. r8 |document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* I& o8 a6 n! c$ ?" H0 v; U6 Q5 nvar actualwidth=''
/ }% e" x! l& O3 C1 j3 ]0 {var cross_marquee, ns_marquee2 ?) c$ y# N0 H
: U# K" |' W$ u" g4 }
function populate(){; n5 w' Z: Z$ {' w
if (iedom){" k3 q0 p3 M" O0 B' M5 C, J3 k) \: _/ D
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 i- s8 K% p+ y* e* R6 S4 e$ K
cross_marquee.style.left=marqueewidth+83 G S( X! L& ~" B% K& P( G) G
cross_marquee.innerHTML=marqueecontent' _: j2 G4 C2 K3 b/ f# Z8 p
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 f: U) Z4 w y d2 C L2 r
}
' N2 u" Z0 N) c- a j" Lelse if (document.layers){
2 T/ c8 R p& l) ~: T' vns_marquee=document.ns_marquee.document.ns_marquee25 {; G; T7 g. R5 \ g- f
ns_marquee.left=marqueewidth+8- G8 [% _9 N' C, q. P6 S) M
ns_marquee.document.write(marqueecontent)0 u8 c2 p% G, D& R& p6 {
ns_marquee.document.close()' ` ]1 d0 @$ j; l5 C. Z2 K& }1 j8 `
actualwidth=ns_marquee.document.width& \* x$ ]" F! ~/ H
}. a4 m- ?* }- [ V; Y
lefttime=setInterval("scrollmarquee()",20)! E2 L! _/ u( n8 A* M
}: y! g; j+ J& T" R k9 `
window.onload=populate
% g! i; ?* G9 Y' p j4 a8 e" c4 [0 N8 S& N9 a' ^1 P6 J4 E
function scrollmarquee(){
& V, f e) n# G6 k3 f/ g- Jif (iedom){9 Z3 Y4 W& V7 D7 _) b% @
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) l2 D" d( v& _+ hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 s# }- X+ E' [
else
" `# B6 t" Z& x; m$ ?cross_marquee.style.left=marqueewidth+85 i/ X3 C% b4 ]* K0 W. x5 @
! h( _ n+ F0 B0 o+ M9 d
}, x; Y4 |' @# l7 j; x; a
else if (document.layers){) R0 t7 k8 y$ F0 E8 L, U* P
if (ns_marquee.left>(actualwidth*(-1)+8)). t- u- n/ l% k( `2 q8 F& w
ns_marquee.left-=copyspeed% s) t" L5 Z2 }$ s. T+ n( H
else
' c6 q8 ^0 M" V1 l0 ^8 _0 `ns_marquee.left=marqueewidth+8
, U- G1 T3 A0 a4 x}
$ {: F1 g- J+ |+ T+ q' I9 q: C. Q7 i6 y% u}
7 @( R) g" C' Q. N: f* M# g6 F6 h5 K. U' K3 Q
if (iedom||document.layers){$ q! E, A& s1 w# B ~4 `
with (document){
9 R- D* v2 X8 K+ i$ C; cdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) ~3 f/ {2 W# A$ nif (iedom){
6 N3 R7 Y8 f$ a8 z* cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% d6 h3 ?3 g. y# M! S, f; r
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 a% x* t' s5 P0 J9 T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, N9 `# V1 Y5 X' {4 X, ^& lwrite('</div>')2 n4 w+ C* u1 O" z" O( A" U
}
+ _ `" n L ?else if (document.layers){: r/ W4 H) q4 K; j# r
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ D2 C2 j2 z! x. m" b8 Y0 z. X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# E0 \4 l% H4 h: Q/ w! gwrite('</ilayer>')
1 k* o. I9 Z+ b}' y% t: F' @' ~: @
document.write('</td></table>')% f+ j% D7 O4 D( S+ c
}' t4 D: a6 `' n+ L/ H
}3 ?7 ]. [- |3 |: S6 O, U
</script> |
|