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

|
网页之跑马灯文字特效
//修改宽度/ Z( n, Q1 ~4 F" R
var marqueewidth=300
" i. Q5 E7 v& C4 {) D Z6 r//高度: E. x6 c3 z, D7 E8 |9 j2 e% V2 q! N
var marqueeheight=25
+ o) u# Q. K! a4 }; r//速度(1-10)" n3 [& q' ~7 N& X
var marqueespeed=3/ x% D+ c+ k6 I1 | c h
//背景颜色6 f; x* W' S0 O4 @7 u6 D+ o8 B
var marqueebgcolor="#FFFFFF"6 O0 ^0 B8 t- K- v
//是否能暂停 (0=no. 1=yes)?
& g% {% m; r* }/ w7 Z) r) C- @4 Qvar pauseit=1
+ H% T. _0 g% Z \" h: ^& d1 _, r$ r% c2 k/ {7 o! K
//修改显示内容
$ H! R( y1 K- g" { L: b2 _5 z2 S8 S; ?var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) j: J. B* @; S$ o9 N3 [3 z
) u7 X! R0 P. t; v1 A/ \# X" T* U6 X# i4 I
////下面不需改变////////////5 N! _( R8 ], p/ E7 T9 l1 Z
# e" P2 |- S2 g9 z, Z/ r
var copyspeed=marqueespeed
) F) h+ }, z3 u* O( }# Bvar pausespeed=(pauseit==0)? copyspeed: 06 q9 H1 m8 t: S- K
var iedom=document.all||document.getElementById
4 P7 h& p, d5 Q. Uif (iedom)
# H3 @3 |% V. X. Kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' E! |4 J& O4 w) a7 W, N- z: R4 Cvar actualwidth=''
7 [) e! s; _. R1 ~( x' mvar cross_marquee, ns_marquee4 @& K$ Q8 t& Q$ E3 I0 [
+ ?% V" t- o: l1 L0 efunction populate(){8 N1 `* x$ B# y: p
if (iedom){4 Z7 T7 U! b0 [
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: a. R" J7 @: a' Z" c3 F: U
cross_marquee.style.left=marqueewidth+8
7 Q* _# t7 B& x; Y' q' l0 f/ ecross_marquee.innerHTML=marqueecontent5 h8 K& o) _, L3 l% f" ?. B3 J! H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: J9 l O; T! Y& s8 A
}/ L% q+ S. _! _& i- o$ e& a& W' j7 `- [
else if (document.layers){
7 k# u6 J( U$ E2 n& S* ?ns_marquee=document.ns_marquee.document.ns_marquee20 q; N# U. O1 g6 \; W ^$ x
ns_marquee.left=marqueewidth+89 t8 N' ^. a, L+ K2 A8 r; e
ns_marquee.document.write(marqueecontent)+ B: T1 Z. L6 a T4 A
ns_marquee.document.close()
/ _$ s+ }7 k- @% K' w2 xactualwidth=ns_marquee.document.width/ c7 i3 E& U/ {+ `
}
2 ]8 c8 ~, Q! x* Ilefttime=setInterval("scrollmarquee()",20)
; B( A. K% f8 X* p$ p2 Y* C5 b}0 O: _# a" l6 K ^% z+ \$ _6 m
window.onload=populate
/ L, _0 M6 _4 r6 g8 R2 O
* w' W. K' x! F9 q+ ffunction scrollmarquee(){
" t8 ^' R( M& M+ E/ t1 |if (iedom){4 ]: F; ?) M8 M1 a* Q. P
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 B" s* {: l5 ]& ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 K- u# Z6 ~6 p* r melse
4 d+ Z8 j$ z2 e2 V. Rcross_marquee.style.left=marqueewidth+8" y' R- g4 }: n5 l
5 Y- Q V, s2 p' w: r# @% p}
( w+ S0 F$ [9 | K+ Belse if (document.layers){
& B* [4 u+ ~! R! V- C4 \* Fif (ns_marquee.left>(actualwidth*(-1)+8))2 t6 R G9 P- v3 O1 s2 a
ns_marquee.left-=copyspeed
* I0 d1 ?/ K2 l& Lelse
- \3 I. l% A8 Q' N+ v4 wns_marquee.left=marqueewidth+8* z( d, ^1 e6 E& L! M& T0 i# v
}
: M5 r# z' e0 P}$ y9 U; M G- \1 ]/ A: n. O4 Q
0 _7 f& M; p% P9 `0 ^6 R; r9 Cif (iedom||document.layers){
2 L& n- F0 `2 A4 k! w8 v( J0 Jwith (document){
- W+ f; Q" `/ ~" N5 Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# o6 I$ u3 z' i1 Z
if (iedom){6 n- q) }" [9 t8 O
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 @ h( n, p# }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ e% u1 A1 T; ^$ Y# y) |
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; T2 k' z; N6 ?$ D+ [+ M; X1 ywrite('</div>')
: F/ f) L* p+ }3 i/ U- n" y}, a: I- |* v! {
else if (document.layers){
6 K9 Y0 j, C/ `! [write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), ^& j! o* t! t+ X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 I) k# q9 m2 Y0 T( ~4 v9 U: o
write('</ilayer>')' u# q( Z3 A* ~3 V% F, K
}7 {$ c0 W& W. C+ Z: ~3 }9 Y) d
document.write('</td></table>')1 I! v8 _7 o! ~5 }$ y1 I# `
}
0 a1 b, F& W% ~4 K* O! S3 c}
$ l6 q8 f; m( J' ^</script> |
|