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

|
网页之跑马灯文字特效
//修改宽度% V# Z3 {, m, F2 b1 t* P
var marqueewidth=3004 k4 n9 Z7 n+ I0 g$ n! X5 E
//高度
# m7 Y2 K M; A; Q7 O0 Mvar marqueeheight=25
* e8 ^0 D6 @- ~/ [& ]" T9 R//速度(1-10)
! i* E) F1 G7 j0 j8 ~: o. `var marqueespeed=39 @6 V+ T. w# q
//背景颜色# U- D. d+ ~. ~& x& S; z
var marqueebgcolor="#FFFFFF"
/ Z& E, Q$ B3 y9 d6 g5 G//是否能暂停 (0=no. 1=yes)?
$ o( U, \4 v0 Z! E$ P+ kvar pauseit=1- T5 Y* T5 o6 o2 W6 V2 q: i
$ v0 L7 K4 \" {
//修改显示内容. Z. A4 H. f/ s9 W; b1 C/ ^% j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 N* n8 e" {' p: g% v
2 ]' Q+ E: ~8 }+ o7 E! Y+ Q
0 H( C2 p. G, c5 x5 O, k////下面不需改变////////////
/ W( m; q0 X2 Q2 C( \* v* R3 K
* ~& t# I- c' ivar copyspeed=marqueespeed- }2 ^( `( v! Y6 v! n
var pausespeed=(pauseit==0)? copyspeed: 08 [+ m {' U+ u3 G( G$ X0 v
var iedom=document.all||document.getElementById9 @! K3 z4 w5 U* e
if (iedom)
6 L1 B6 g& z' Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; N6 D2 w0 v8 J \0 ~( l. j) \: v" i; Cvar actualwidth=''
7 i5 ?: n" a* _* o; G. l8 {var cross_marquee, ns_marquee
5 e5 B! l" S, U
8 Z, e" Z+ r8 F' s' n+ u7 @function populate(){9 u% p. x+ i3 I7 C
if (iedom){( T4 f' X+ t7 {" q& G+ z1 i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 N9 u/ g# B' b- L2 ?: R+ N1 k Z ]
cross_marquee.style.left=marqueewidth+8
4 I, S& \/ ?( w1 |5 l6 p& fcross_marquee.innerHTML=marqueecontent2 \0 @' L- _# A& W! C; v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 t# C% k) V5 C
}
. Y* C; M) n1 d: D/ S4 }2 h* X6 welse if (document.layers){, x: A0 o/ R- y0 A1 s) D, f
ns_marquee=document.ns_marquee.document.ns_marquee2
4 R% o7 w' e7 n& Qns_marquee.left=marqueewidth+8
5 k4 h$ y* m {- I. Uns_marquee.document.write(marqueecontent)& x) ?! W" G# s6 r& X
ns_marquee.document.close()
; d' y r( I; ^( l# C% Ractualwidth=ns_marquee.document.width3 P- ?3 y9 O! a: w* P4 z, J, Y
}* |3 p, ]$ D3 K2 I2 W/ P9 e
lefttime=setInterval("scrollmarquee()",20)
- W: W. i6 ^6 E3 S' U: z0 x}8 _8 k; p3 a, P- c# p5 g- m8 m
window.onload=populate
. V3 @0 w2 B/ [% w. e I8 }0 k! |! m) d( i6 e
function scrollmarquee(){
* `- X/ I: p+ D2 e1 wif (iedom){. E! o5 ^3 u& u7 o8 \& t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, N% z- c$ w4 \4 Y: t, Y1 @cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- u _0 B) D" Q9 melse% ^& l; Z6 k: z: z
cross_marquee.style.left=marqueewidth+8
& O* x. N& _( _. [, J& C2 q! J4 ?5 Q& g8 N( t0 L5 c) C h
}$ L1 t" @. t" b
else if (document.layers){) R6 o* \4 R1 ~ q
if (ns_marquee.left>(actualwidth*(-1)+8))3 ^$ \# ^% ?) Q
ns_marquee.left-=copyspeed' {+ C# o/ N( E; p3 a' K: q6 B! c& l
else# t, i7 i. X% z) J" b
ns_marquee.left=marqueewidth+8 n/ ^6 M) T+ Y H- M1 ?
}5 n7 F$ J( L/ R$ X
}
* k( a7 u2 A& `2 e
) [* c* o( |+ O( x, ~7 l2 eif (iedom||document.layers){
6 ^# H* V( j' V: O2 e5 l; b! x0 p" u: r( Fwith (document){
7 S! l. U1 r2 Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 v$ R& Y9 E! w9 @if (iedom){% w9 A" O/ }4 R
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 q0 R- `7 _* h- L; l' L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 _. A! s6 c; L" O- a& f: Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ k+ _) I7 v' }9 g) z! S0 }write('</div>')
( n$ I3 j2 _- I+ ~2 q6 z" W}. G' i4 ?& B+ z3 |) I/ x3 \
else if (document.layers){. i. l" j y9 W6 S. b" t0 [
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>') G/ e- y% q P: W$ {
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). n4 t. f' o. r3 n3 s: N+ q7 u
write('</ilayer>')9 U. V: r# a+ l- T# ~1 C
}
0 {0 w$ P. _( N+ x5 L6 gdocument.write('</td></table>'): c+ a8 x/ @2 p% n
}. X \7 Z; }" T, H& W; D) j
}4 w1 _8 w1 r( [ X7 e ?2 b [
</script> |
|