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

|
网页之跑马灯文字特效
//修改宽度
* v" m4 X# i5 yvar marqueewidth=300
' C+ A# [2 s0 {' C//高度( j; S0 z* Z% {
var marqueeheight=25 O) R: ^ ^# e
//速度(1-10)* l; U( r# c- C# z+ M7 s
var marqueespeed=3' ^9 H3 i/ l# M9 P6 g" n
//背景颜色
4 e/ {& v* v0 O; g% \. ~9 evar marqueebgcolor="#FFFFFF"
; c9 G) {0 ~2 h9 H+ W# Y# x2 a//是否能暂停 (0=no. 1=yes)?
! U$ _- K$ _3 Fvar pauseit=1( s W0 {5 I* f) m& F
+ B2 A5 x2 T1 h2 U+ T//修改显示内容4 i' l+ b' S! n" E; r
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- w- L$ k; w, l& g3 M+ g
2 o4 v/ S; e6 z+ S
: S6 d, i( e6 Z/ r2 g////下面不需改变////////////- m+ ` ?; ~( V. E: g' B' x/ q6 s
" k) b( s* `4 H4 s3 cvar copyspeed=marqueespeed
( I' U i: ~; T( gvar pausespeed=(pauseit==0)? copyspeed: 0
' B* F2 E4 P- w& o& Y& Fvar iedom=document.all||document.getElementById% I0 G$ w4 t+ Y0 s v: ?$ q
if (iedom)
1 b' ~4 O; b* D, U( v7 `* ^6 J' ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 ~3 m; F& s7 l; c. A+ Jvar actualwidth=''
) ]* ^/ i3 e+ ^: b' r3 bvar cross_marquee, ns_marquee
, {. \3 T& E$ \. L3 C- Z
v( W {5 K2 U/ `5 yfunction populate(){) T6 V5 w# S% b# {6 P( M
if (iedom){
8 f9 @! j0 f, C Z8 ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 K6 k& \* s( u8 M2 Q: j- Vcross_marquee.style.left=marqueewidth+8
) N# E5 d( c# W; Mcross_marquee.innerHTML=marqueecontent$ s0 o& N% m8 D9 d$ j2 d0 @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
G4 [( ]) ~7 k" ]& |}) n0 }4 T' x _! V v7 s" d0 p
else if (document.layers){
& f5 d+ D# ~8 v& m+ sns_marquee=document.ns_marquee.document.ns_marquee2
( }9 v1 d- h. ens_marquee.left=marqueewidth+8
+ ]) x2 u0 {8 p( W# z# v8 d$ d, ans_marquee.document.write(marqueecontent)+ L! G2 I5 a5 x; n' f- s
ns_marquee.document.close()# j/ J" p f7 Z8 t# z+ I0 k! m
actualwidth=ns_marquee.document.width
/ `4 j. J# f& J5 R' j}
( I, d4 k3 B& m( i: L5 O1 |0 p. plefttime=setInterval("scrollmarquee()",20)
6 J: J) r: K; o& B}+ z% A; v7 R3 h
window.onload=populate9 @" F$ g" _6 r1 R! g3 q8 P
' q- a1 {/ A/ g7 }' I+ M
function scrollmarquee(){% p( ^' P! ^1 [
if (iedom){
6 j5 [* p. ~% d; x U6 ~4 pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ }- R( c- L6 j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 m# o# _) ]2 ~% y0 Oelse* q$ b; z% B& u1 n$ t7 G" E) M4 X
cross_marquee.style.left=marqueewidth+8% ^, O& J) V8 R3 C
* J# n# e; g/ b. R
}7 @8 Z/ ~, F4 R+ R% M$ j' M
else if (document.layers){0 R( C6 S; Z8 g: D1 q5 u& G
if (ns_marquee.left>(actualwidth*(-1)+8))
1 @, J: i4 `" ]6 k8 [9 v, B& Fns_marquee.left-=copyspeed
0 {( a4 g% f( M' u) t: W1 Delse
/ a8 r* C1 g* j" U0 `ns_marquee.left=marqueewidth+8: {1 G5 A$ R9 i2 `
}
) R6 ^- F5 K. }6 c}3 [* H p) D; t' m5 y
/ G8 \; D4 I) @
if (iedom||document.layers){
! Q8 S' F8 o8 c. |3 gwith (document){' d+ l3 y0 [" r7 @
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 Z" K* r4 |9 t, D* V' \. oif (iedom){4 w7 \9 q, I( r- J7 Z( e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ `! ]% Q# C- f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( V6 |& [& ]3 z: R- b0 D$ \# ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 [; C2 s5 [: B% d3 p4 G$ D$ owrite('</div>')! Z2 Y; N' d3 r( G
} c- o' T" X. v
else if (document.layers){
4 ~1 S: ]7 D# n+ z1 l+ D1 @write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# u( I" I: q9 S0 m2 i! P2 O/ e0 Fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ `& H& G5 O/ k! M
write('</ilayer>')6 Y1 H5 K, K1 Z$ f2 O) H, A
}" T/ h3 k5 d6 j/ L
document.write('</td></table>')8 ~% U" v. }) o0 A. ?
}9 W6 T/ }" P5 Y* ~% l0 l d
}6 s. i$ I+ r! _; ]& a0 B
</script> |
|